It being nearly midnight it is hard for me to come up with the proper response to this ...
Hopefully someone will beat me to it by morning. And no .. that doesn't mean that I think it is a particularly difficult question ... merely that it deserves less sarcasm than I am likely to inject :-) basically I would do something like select 1 into v_deptno from the_table where dept_num = deptno; and handle the |NO_DATA_FOUND exception to get the -1 You are making it entirely too hard on yourself. Rob | JNewMember wrote: > Actually what I want to do is print a value based on what the select > statement capture. Something like when the user execute this procedure > if the user entered department found print 1 else print -1 > > Anu > > On Sep 21, 10:17 pm, rob wolfe <[EMAIL PROTECTED]> wrote: > >> Procedures do not return values ... Functions do ... >> >> I suggest checking the documentation for "Create Function" rather than >> "Create Procedure" and all will be revealed. >> >> JNewMember 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 Oracle-PLSQL@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---