Home » SQL & PL/SQL » SQL & PL/SQL » Executing Default Parameter in Procedure
icon1.gif  Executing Default Parameter in Procedure [message #249131] Tue, 03 July 2007 08:08 Go to next message
sibgat
Messages: 45
Registered: November 2006
Location: Chennai
Member

Hi,
i have a procedure which has 3 parameters, where the 2nd paramete r by default it will take value as 'SIB' just want to know how to execute this,so that it takes default value for 2nd parameter.



CREATE OR REPLACE PROCEDURE NullCheck(NO IN Number,Name IN VARCHAR2 DEFAULT 'SIB',NUM IN Number)
IS
  BEGIN
        DBMS_OUTPUT.PUT_LINE('ENO'||NO||',ENAME'||NAME||',Num'||NUM);     
  END;
  


Thanks in advance
Sib
Re: Executing Default Parameter in Procedure [message #249134 is a reply to message #249131] Tue, 03 July 2007 08:18 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Use named parameters:
exec nullcheck(no => <value for no>, num => <value for num>);


By the way:
SQL> select  * from v$reserved_words where keyword in ('NO', 'NAME');

KEYWORD                            LENGTH R R R R D
------------------------------ ---------- - - - - -
NAME                                    4 N N N N N
NO                                      2 N N N N N


Bad idea to use those as parameter names

[Updated on: Tue, 03 July 2007 08:20]

Report message to a moderator

Re: Executing Default Parameter in Procedure [message #249137 is a reply to message #249134] Tue, 03 July 2007 08:24 Go to previous messageGo to next message
sibgat
Messages: 45
Registered: November 2006
Location: Chennai
Member

Can you give the exact exec statement,
Thanks
Sib
Re: Executing Default Parameter in Procedure [message #249138 is a reply to message #249137] Tue, 03 July 2007 08:26 Go to previous messageGo to next message
sibgat
Messages: 45
Registered: November 2006
Location: Chennai
Member

Thanks Frank,
i Got It
Thank you very much
Rgds
Sib
Re: Executing Default Parameter in Procedure [message #249399 is a reply to message #249138] Wed, 04 July 2007 06:08 Go to previous messageGo to next message
iamdurai
Messages: 96
Registered: April 2007
Location: Chennai
Member

Hi sibgat,

please post your executed statement.

it is helpfully others also.


Reds
Thangam.
icon7.gif  Re: Executing Default Parameter in Procedure [message #249415 is a reply to message #249399] Wed, 04 July 2007 07:07 Go to previous message
sibgat
Messages: 45
Registered: November 2006
Location: Chennai
Member


Hi,
Below is the executed snippet

SQL> exec nullcheck(no => 10, num => 11);
ENO: 10,ENAME: SIB,Num: 11

PL/SQL procedure successfully completed.


Regards
Sib
Previous Topic: Need help in a query.
Next Topic: Checking duplicate ROWS
Goto Forum:
  


Current Time: Sun Dec 11 06:03:24 CST 2016

Total time taken to generate the page: 0.04893 seconds