Home » SQL & PL/SQL » SQL & PL/SQL » Re: question
Re: question [message #36019] Tue, 30 October 2001 06:58
Suresh Vemulapalli
Messages: 624
Registered: August 2000
Senior Member
are you trying with cursors?
Look at following code...sql%rowcount will not work for cursor variables.

create or replace package p is
type c1 is ref cursor;
procedure samp99(s in out p.c1);
end;
/
create or replace package body p is
procedure samp99(s in out p.c1) is
c2 p.c1;
l_count number ;
l_cursorcount number:=0;
begin
select count(*) into l_count from sample;

open s for select x as y from sample;
if l_count=0 then
open s for select s as y from sample1;
end if;

end;
end;
/
declare
s p.c1;
y number;
n number;
begin
p.samp99(s) ;
loop
fetch s into y ;
exit when s%notfound;
dbms_output.put_line(y);
end loop;
end;

SURESH

----------------------------------------------------------------------
Previous Topic: question
Next Topic: Re: SELECT with variables
Goto Forum:
  


Current Time: Fri Mar 29 08:39:25 CDT 2024