Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: sql select statement question from newbie
"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