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

Home -> Community -> Usenet -> c.d.o.server -> Re: How to write a function with variable parameters?

Re: How to write a function with variable parameters?

From: Paul Q <paulq_at_home.com>
Date: Sat, 02 Jun 2001 16:56:12 GMT
Message-ID: <MU8S6.10857$Be4.2880654@news3.rdc1.on.home.com>

create or replace function sf_case (case_1 element_type, case_2 element type)
return var_name element_type;
is
begin
....

return(var_name);
end;

"Dino Hsu" <dino1_at_ms1.hinet.net> wrote in message news:dpehht06m4vpvhj6nhihqdrna629aur9r2_at_4ax.com...
> Dear all,
>
> To similate the Oracle 8i CASE WHEN ... THEN ... ELSE ... END clause
> in Oracle 8, I need to write a stored function like this:
> FUNCTION sf_case(case1, case2, case3, ..., case-n, ...) RETURN NUMBER
> where case-n's are all of boolean type.
> This function will check case1 first, then case2, case3, etc., and
> return the n that first evaluates to true.
>
> An extended edition is like this:
> FUNCTION sf_case_ex(case1, value1, case2, value2, case3, value3, ...)
> RETURN value_type
> where value-n's are the corresponding return values.
>
> These two functions will compansate the limited DECODE() built-in
> function in Oracle 8. I cannot figure out how at the moment, I hope
> someone can help me with this. Thanks in advance.
>
> Dino
>
Received on Sat Jun 02 2001 - 11:56:12 CDT

Original text of this message

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