|
-
Hi
Please look at following function. I am writing a function similar to below
When I pass the value which is existing in emp table then it returns me the proper values but when I pass value (for eid) which is not there in emp table then it does not return the values which are there in exception block.
if I run it independently (both queries ) it runs well . then why query in exception block is not running.
(The pack1.cursortype is an already declared packaged cursor)
create or replace function Listemp(eid in number)
return pack1.cursortype is
l_cursor pack1.cursortype;
iapno number;
begin
open l_cursor for
select empno, ename, job
from emp
where empno = eid;
return l_cursor;
exception when no_data_found then
open l_cursor for
select distinct 1 empno,'Smith' ename, 'Manager' job
from dual;
return l_cursor;
end;
Amol
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|