Skip to Main Content

Oracle Database Discussions

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!

Cursor with if then statements in oracle stored procedure

903048Dec 1 2011 — edited Dec 1 2011
Please help I have a situation where I need to have if then statements inside the cursor I am a newbie to Oracle and not sure how to do this

the following sample code throws errors

cursor c_students is
if v_Active = '1' then
select student from users where username in ('abc' );
else if v_Active = '0' and student_status = '1' then
select student from users where username in ('def');
else if v_Active = '0' and student_status = '2' then
select student from users where username in ('def','abc');
end if;
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 29 2011
Added on Dec 1 2011
6 comments
1,405 views