Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Calling functions - NULL vs default
PhilHibbs wrote:
> In an Oracle function or procedure call, there can be parameters that
> have defaults, such as language code. If NULL is passed, this overrides
> the default. What I want to do is to create a table that mirrors the
> function's parameter list and call the function using the rows in that
> table, but I don't want to override defaults with NULLs. How can I do
> this? Is dynamically generating a function call the only way? Might
> this cause a significant performace hit, for instance if I were
> creating thousands of employees through the HRMS create_employee API?
>
> Phil Hibbs.
>
Hi Phil,
what a about testing the parameters in the function body and assign
default values to local variables if a parameter is NULL?
Something like:
function ProcessRow(Col1 in MyTable.Col1%Type, Col2 in
MyTable.Col2%Type, ...) return number is
vCol1 MyTable.Col1%Type;
vCol2 MyTable.Col2%Type;
begin
if Col1 is null then
vCol1 := DefaultValueCol1;
else
vCol1 := Col1;
end if;
if Col2 is null then
vCol2 := DefaultValueCol2;
else
vCol2 := Col2;
end if;
...
end;
Best regards
Thomas
-- For answers by personal mail use: thomas.sommerfeld at domain ust-gmbh.deReceived on Tue Jul 18 2006 - 17:00:00 CDT