If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Oracle > PL/SQL procedure.. IN parameter..

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-31-03, 05:30
senthil5_kumar senthil5_kumar is offline
Registered User
 
Join Date: Jan 2003
Posts: 18
PL/SQL procedure.. IN parameter..

Hi,
I have a PL/SQL procedure of following structure
CREATE OR REPLACE PROCEDURE proc1(param1 IN VARCHAR2,param2 IN VARCHAR2)
IS
BEGIN
-----Statements goes here
END;
/

Can I call the procedure like this
execute proc1('ssk',)
ie without passing any value to the second pramater?

becos my requirement is that the param2 is optional
if I call the procedure like "execute proc1('ssk',)"
I get the error message..............

So can any one please tell me how to handle this situation.
Thanks in advance.
Regards,
Senthil
Reply With Quote
  #2 (permalink)  
Old 01-31-03, 05:41
remivisser remivisser is offline
Registered User
 
Join Date: Dec 2002
Location: Netherlands
Posts: 118
Default

Yes you can:

You'll have to declare a defualt value for the in parameter though:

[REMI@ORA-0000.COM] CREATE OR REPLACE PROCEDURE proc1
2 ( param1 IN VARCHAR2,
3 param2 IN VARCHAR2 DEFAULT NULL)
4 IS
5 BEGIN
6 NULL;
7 END;
8 /

Procedure created.

[REMI@ORA-0000.COM] EXEC proc1('Hello')

PL/SQL procedure successfully completed.

Good luck!!
__________________
Remi Visser

Oracle Database Administrator
(OCP certified 8i)

Homepage: http://home.remidian.com/
Reply With Quote
  #3 (permalink)  
Old 01-31-03, 06:08
senthil5_kumar senthil5_kumar is offline
Registered User
 
Join Date: Jan 2003
Posts: 18
Re: Default

Thanks a Lot
Regards,
Senthil

Quote:
Originally posted by remivisser
Yes you can:

You'll have to declare a defualt value for the in parameter though:

[REMI@ORA-0000.COM] CREATE OR REPLACE PROCEDURE proc1
2 ( param1 IN VARCHAR2,
3 param2 IN VARCHAR2 DEFAULT NULL)
4 IS
5 BEGIN
6 NULL;
7 END;
8 /

Procedure created.

[REMI@ORA-0000.COM] EXEC proc1('Hello')

PL/SQL procedure successfully completed.

Good luck!!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On