| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> How to write a function with variable parameters?
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
![]() |
![]() |