Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: PL/SQL: Dynamically calling a function., Need help
I think all you need is a driver function:
CREATE FUNCTION RuleDriver(rule IN VARCHAR2, an_object_id IN NUMBER, as_error_msg OUT VARCHAR2) RETURN NUMBER ASBEGIN
. . . ELSIF rule = 'RuleZ' THEN RETURN RuleX(an_object_id,as_error_msg); ELSE RAISE_APPLICATION_ERROR(-20001,'Invalid Function '|| rule);END IF;
Dynamic SQL will work too, but it would be slower.
Solomon.Yakobson_at_entex.com
In article <aj.26.000CF4D7_at_knoware.nl>,
aj_at_knoware.nl (Allard Siemelink) wrote:
>
>
> Hi,
> We're currently working on a large project and need to call
> stored procedures and functions dynamically from PL/SQL.
> All functions have the same input and output parameters and
> return a number. e.g.:
>
> function ruleX (an_object_id in number,
> as_error_msg out varchar) return number
> begin
> --BODY
> end;
>
> Is it possible to call such a function dynamically? (Meaning
> retrieving the name of the function from a database column into
> a local varchar variable, compose the function call syntax
> 'execute ruleX(...)' in a varchar variabele and then call it)
> And if it is, could some kind soul provide an example showing
> how to call such a function, passing the input parameters and
> retrieving the output parameters and return value?
>
> TIA,
>
> -Allard
-------------------==== Posted via Deja News ====----------------------- http://www.dejanews.com/ Search, Read, Post to UsenetReceived on Wed Apr 16 1997 - 00:00:00 CDT