Home » SQL & PL/SQL » SQL & PL/SQL » question
question [message #36013] Tue, 30 October 2001 05:14 Go to next message
neru
Messages: 2
Registered: October 2001
Junior Member
Hi,
Iam trying to select from three tables into a cursor
what i need to do is if there are no rows retrieved
from the above select, i have to select from other
three tables. i what i need is..
how to check whether the first select has retrieved any rows. one thing i know is to do that in a if condition
but how to write the stored proc.
is there any command or statement to see whether any rows retrieved from the first select, if not how to tell the process to go to the next select.
this looks like a easy question, but iam learning how to write this.
appreciate any one help.
Thanks

----------------------------------------------------------------------
Re: question [message #36017 is a reply to message #36013] Tue, 30 October 2001 05:39 Go to previous message
Suresh Vemulapalli
Messages: 624
Registered: August 2000
Senior Member
create or replace procedure samp99 is
cursor c1 is select * from sample;
cursor c2 is select * from sample1;
l_cursorcount number:=0;
begin
for i in c1 loop
-- process 1st cursor here
l_cursorcount:=c1%rowcount;
dbms_output.put_line(i.x);
end loop;
if l_cursorcount=0 then
for j in c2 loop
dbms_output.put_line(j.s);
end loop;
end if;
end;

----------------------------------------------------------------------
Previous Topic: TRIGGER PROCEDURE
Next Topic: Re: question
Goto Forum:
  


Current Time: Mon Oct 26 13:10:07 CDT 2020