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 -> Re: sql select statement question from newbie

Re: sql select statement question from newbie

From: Graham Miller <lgmiller_at_elmrd.u-net.com>
Date: Sat, 02 May 1998 12:39:19 GMT
Message-ID: <354c0c93.362395@beta.news.u-net.com>


"Colin Sutherland" <c.sutherland_at_easynet.com> wrote (in <6iev28$sik$1_at_apple.news.easynet.net>)...

| Peter
|
|

Hello Peter,
  Since a Cursor is always going to end (return no rows) at some point, Oracle have arranged that it does *not* raise a NO_DATA_FOUND exception.

Another way of coding the function (in SCOTT/TIGER):

FUNCTION QryEmployeeExists

    (pEmpNo IN Emp.EmpNo%TYPE)
 RETURN BOOLEAN
 IS  

 CURSOR c1 IS
   SELECT E.EmpNo
   FROM Emp E
   WHERE E.EmpNo = pEmpNo;  

 lC1_r C1%RowTYPE;
 lFound Boolean;

BEGIN
    OPEN c1;
    FETCH c1 INTO lC1_r;
    lFound := C1%Found;
    CLOSE c1;  

    RETURN lFound;
EXCEPTION
 WHEN OTHERS THEN
  Raise_Application_Error(-20000,
    'QryEmployeeExists:'
    || To_Char(SQLCode) || ' - ' || SQLErrM); END; graham Received on Sat May 02 1998 - 07:39:19 CDT

Original text of this message

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