Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> More efficient way
Is there a more efficient way to do this so I don't have to select on
the database twice? I.e. can I look ahead at the result of a select or
anything like that? To find out if the search was empty, i have to
fetch the results, but then the results are no longer in the cursor so I
have to do the select again!
create or replace function get_user_info(usid in integer, userinfo in out types.cursortype) return integer as errcode integer;
cursor checkempty is select userid from users where userid = usid; checkval checkempty%rowtype;
begin
fetch checkempty into checkval;
if checkempty%found then
open userinfo for select * from users where(userid = usid);
errcode := 0;
else
errcode :=1;
end if;
close checkempty;
return errcode;
end;
/
Received on Fri Jun 18 1999 - 20:44:22 CDT
![]() |
![]() |