Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> More efficient way

More efficient way

From: Dan Hess <dah23_at_cornell.edu>
Date: Fri, 18 Jun 1999 21:44:22 -0400
Message-ID: <376AF5F6.A8691EE1@onshare.com>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US