Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

function returned without value

351480Dec 3 2004 — edited Dec 7 2004

I have a function that compiles fine, but I can not return the value. I haven't created many functions and I am unsure if its just a simple syntax error, or if my whole structure is wrong.


CREATE OR REPLACE FUNCTION f_hours (v_id varchar2, v_term varchar2) RETURN varchar2 IS
Begin
Declare
v_hours number(5) := 0 ;
CURSOR c_hours is
select shrtgpa_hours_earned
from shrtgpa, spriden
where shrtgpa_pidm = spriden_pidm
and spriden_change_ind is null
and spriden_id = 'v_id'
and exists (select 'x' from sfrstcr
where sfrstcr_pidm = spriden_pidm
and sfrstcr_rsts_code='RE'
and sfrstcr_camp_code = '1'
and sfrstcr_term_code = 'v_term');
Begin
open c_hours;
loop
fetch c_hours into v_hours;
exit when c_hours%notfound;
if v_hours >= 48 then
return 'TRUE';
else
return 'FALSE';
end if;
end loop;
close c_hours;
EXCEPTION
when no_data_found then
return ('wrong id');
end;
end;

========
*
ERROR at line 1:
ORA-06503: PL/SQL: Function returned without value
ORA-06512: at "F_HOURS", line 32
ORA-06512: at line 1

Comments

Processing
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jan 4 2005
Added on Dec 3 2004
5 comments
287 views