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 -> How to write a function with variable parameters?

How to write a function with variable parameters?

From: Dino Hsu <dino1_at_ms1.hinet.net>
Date: Sat, 02 Jun 2001 18:19:13 +0800
Message-ID: <dpehht06m4vpvhj6nhihqdrna629aur9r2@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 - 05:19:13 CDT

Original text of this message

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