default patameter [message #57046] |
Fri, 16 May 2003 09:19 |
Eugene
Messages: 44 Registered: August 2001
|
Member |
|
|
Hi all,
I have a procedure which takes no parameters. Some times I need to run that same procedure with one or two parameters. They will by used in the cursor, which produces the output. If I can say something like:
create procedure Z(x IN varchar2 default := ''
y IN varchar2 default := '') as
cursor aaa is
select ....
from .....
where ???? HOW DO I HANDLE IT IF PARAMS ARE NULLS
begin
some other statements
.....................
end Z;
then how do I deal with NULL parameters?
What is the "best" way to reuse that code?
Thanks,
Eugene
|
|
|
Re: default parameter [message #57048 is a reply to message #57046] |
Fri, 16 May 2003 11:54 |
Todd Barry
Messages: 4819 Registered: August 2001
|
Senior Member |
|
|
One option:
create procedure z
(x in varchar2 default null,
y in varchar2 default null)
as
cursor csr is
select ...
from ...
where c1 = nvl(x, c1)
and c2 = nvl(y, c2);
begin
...
end;
/
|
|
|
|