• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

how can fix this error

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
after executing :

declare
pi constant number(5,4) := 3.141;
area number(14,2);
cursor rad_cursor is select * from Radius_vals;
rad_val rad_cursor%ROWTYPE;
begin
open rad_cursor;
loop
fetch rad_cursor into rad_val;
exit when rad_cursor%NOTFOUND;
area := pi * power(rad_val.radius,2);
case
when rad_val.radius = 3
then insert into areas values(rad_val.radius,area);
when rad_val.radius = 4
then insert into areas values(rad_val.radius,area);
when rad_val.radius = 10
then insert into areas values(0,0);
else raise CASE_NOT_FOUND;
end case;
end loop;
close rad_cursor;
end;

this code I got out put:
declare
*
ERROR at line 1:
ORA-06592: CASE not found while executing CASE statement
ORA-06512: at line 19

how can I fix this error.
 
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
At line 19 you explicitly raise a CASE_NOT_FOUND exception if none of the other CASE expressions evaluates to true. Either the PL/SQL itself or the calling program needs to handle the exception.

In PL/SQL you might have an exceptin handler

DECLARE
.
.
BEGIN
.
.
EXCEPTION
WHEN CASE_NOT_FOUND THEN
-- Your own code to Log it or return a user friendly error message
-- to the calling program.
END;
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic