Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OUT/IN OUT parameters in PL/SQL function

as far as I understood it, it is only possible to have OUT or IN OUT parameters for procedures, not functions. However, when defining a user-defined aggregate function, I have found this signature:

member FUNCTION ODCIAggregateIterate(self IN OUT DeviationImpl,
value IN NUMBER) RETURN NUMBER

This seems to be a function, however, it has an IN OUT parameter. Could somebody explain me why is this possible?

Thanks

like image 625
leopik Avatar asked Jan 11 '23 08:01

leopik


1 Answers

There is no such restrictions. Functions can have OUT or IN OUT parameters.

However, Oracle recommends against using them.

OUT and IN OUT parameters prevent a function from being used from plain SQL, marked as a DETERMINISTIC function or used as a result-cached function. So these type of parameters are mainly a problem if you want to use the function in a SQL query.

Your example is even more specific: it's a member function, not a global function.

like image 62
Codo Avatar answered Jan 17 '23 05:01

Codo