Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Set Null as Default for input parameter to a stored procedure

RedeMay 28 2010 — edited May 28 2010
hi ,

How can we set default values as NULL to an input parameter in a stored Procedure.
create or replace procedure emp_proc ( p_test_input in varchar2
                                                    p_emp_id in number,
                                                    p_emp_name in varchar2,
                                                   p_manager_id in number )
as
  begin
   if ( upper ( p_test_input ) = 'I' )
   then
      insert into emp
      values      ( p_emp_id  ,p_emp_name ,p_Manager_id,sysdate );
   elsif ( upper ( p_test_input ) = 'D' )
   then
      delete from emp
      where       emp_id  = p_emp_id;
   else
      dbms_output.put_line
         ( 'Please input ''A'' for ADD or ''D'' Delete  EMPLOYEE'
         );
   end if;
end;
As Shown above if i want to do only delete operation

i want to call this procedure like without passing extra parameters .
 EXECUTE  emp_proc('D',1010);
Edited by: Rede on May 28, 2010 12:21 PM

Edited by: Rede on May 28, 2010 12:22 PM
This post has been answered by pollywog on May 28 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 25 2010
Added on May 28 2010
5 comments
29,604 views