Re: Pass optional parameter to a PL/SQL procedure
Date: 2 Aug 2002 07:09:49 -0700
Message-ID: <42ffa8fa.0208020609.7895569f_at_posting.google.com>
Setting param defaults should probably work for you. Or, maybe you were thinking about something that overloading may help? Here is an example:
SQL> create or replace package my_pkg as
2 procedure proc1 (par1 number, par2 varchar2);
3 procedure proc1 (par1 number);
4 end;
5 /
Package created.
SQL> create or replace package body my_pkg as
2
3 procedure proc1 (par1 number, par2 varchar2)
4 is
5 begin
6 dbms_output.put_line('Number and string : '||par1||par2);
7 end;
8
9 procedure proc1 (par1 number)
10 is
11 begin
12 dbms_output.put_line('number only : '||par1);
13 end;
14 end;
15 /
Package body created.
SQL> set serveroutput on
SQL> exec my_pkg.proc1(100);
number only : 100
PL/SQL procedure successfully completed.
SQL> exec my_pkg.proc1(100,' dogs');
Number and string : 100 dogs
PL/SQL procedure successfully completed.
SQL> Hope this helps.
a_sood_at_rediffmail.com (Ak) wrote in message news:<10cb5393.0208011755.1a730368_at_posting.google.com>...
> Hi,
>
> I have a PL/SQL procedure that accepts certain number of input
> parameters. One of the input parameters, passed to the procedure, at
> times can be null. Is there a way in PL/SQL to declare a parameter
> optional or otherwise is there a work around.
>
> Thanks!
> Ak
Received on Fri Aug 02 2002 - 16:09:49 CEST