Home » SQL & PL/SQL » SQL & PL/SQL » Need package
Need package [message #602732] Sun, 08 December 2013 03:52 Go to next message
mvrkr44
Messages: 132
Registered: December 2012
Senior Member
I have a package...need to check whether 1st procedure is having records or not...
if not only i need to call second procedure in the pl sql block..how can i mange it.

create or replace package names

is

procedure (name varchar2,rct1 out system ref cursor);
procedure (name varchar2,rct1 out system ref cursor);

end names;

create or replace package body names

is

procedure (name varchar2,rct1 out system ref cursor)
is
begin

open rct1 for select 1 from dual;

end;

procedure (name varchar2,rct1 out system ref cursor) is

begin

open rct1 for select 1 from dual;

end;

end names;
Re: Need package [message #602735 is a reply to message #602732] Sun, 08 December 2013 04:52 Go to previous message
cookiemonster
Messages: 13920
Registered: September 2008
Location: Rainy Manchester
Senior Member
You mean you only want to call the 2nd procedure if the ref cursor from the first returns no rows?
To know if a ref cursor contains rows you need to fetch them. If you fetch them then they can't be refetched.
So either:
a) have the client call the 2nd procedure if the 1st returns no rows.
b) Write a single ref cursor that combines the selects of both.
Previous Topic: Retrieve data from string column
Next Topic: Mutating Error
Goto Forum:
  


Current Time: Fri Apr 19 21:19:04 CDT 2024