You can use the count(deptno) to avoid all exceptions(NO_DATA_FOUND,
TOO_MANY_ROWS).
select count(deptno) into v_count from dept where deptno = deptNum;
if v_count=1 then
if deptNum = v_deptNum then
returnValue := -1;
else
returnValue := 1;
end if;
else
returnValue := 1;
end if;
Hope this helps.
Anran
On Sep 22, 10:44 am, JNewMember <[EMAIL PROTECTED]> wrote:
> I was able to construct the procedure without syntax but i think I am
> not handling exceptions correctly.
>
> create or replace procedure check_dno (deptNum integer)
> is
> v_deptNum integer;
> returnValue integer;
> begin
> select deptno into v_deptNum from dept where deptno = deptNum;
> if deptNum = v_deptNum then
> returnValue := -1;
> else
> returnValue := 1;
> end if;
> exception
> when access_into_null then
> dbms_output.put_line('Null Pointer Exception');s
> dbms_output.put_line(returnValue);
> end check_dno;
>
> What I want to do is based on what select query find return the value.
>
> Thanks,
> Anu
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Oracle PL/SQL" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Oracle-PLSQL?hl=en
-~----------~----~----~----~------~----~------~--~---