Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Calling functions - NULL vs default

Re: Calling functions - NULL vs default

From: Thomas Sommerfeld <TSommerfeld_at_gmx.de>
Date: Wed, 19 Jul 2006 00:00:00 +0200
Message-ID: <e9jlq4$vm1$2@online.de>


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.de
Received on Tue Jul 18 2006 - 17:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US