Home » SQL & PL/SQL » SQL & PL/SQL » Procedure with optional arguement
Procedure with optional arguement [message #193744] Tue, 19 September 2006 04:22 Go to next message
hari_bk
Messages: 110
Registered: March 2006
Senior Member
I need to write a procedure which takes employee id as optional arguement. if i dont pass any arguement. It should list details of all employees. If i pass employee id. It should display details only for employee id thats passed as an arguement. How to do this..Thanks
HK
Re: Procedure with optional arguement [message #193746 is a reply to message #193744] Tue, 19 September 2006 04:42 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
CREATE OR REPLACE FUNCTION get_emp (p_emp IN varchar2 DEFAULT null) RETURN <stuff> AS....


Inside the procedure, simply check to see if p_emp is null. If it is, you need to get all the employee details, otherwise you just need to return the employee specified in p_emp.
icon14.gif  Re: Procedure with optional arguement [message #193760 is a reply to message #193746] Tue, 19 September 2006 05:40 Go to previous messageGo to next message
hari_bk
Messages: 110
Registered: March 2006
Senior Member
Thanks! its working
Re: Procedure with optional arguement [message #194086 is a reply to message #193744] Wed, 20 September 2006 14:24 Go to previous message
devp2
Messages: 6
Registered: September 2006
Junior Member
Hi,

can u give me that procedure.
i didn't get that one.
thanks.
Previous Topic: Pls correct this simple stored procedure...need help..
Next Topic: DYNAMIC SQL -- How does one dynamically provide the INTO value?
Goto Forum:
  


Current Time: Thu Dec 08 10:07:25 CST 2016

Total time taken to generate the page: 0.08320 seconds