The above example shows how to call a function from SQL * Plus. If you are calling a function from a PL / SQL procedure, see the example below.
DECLARE x NUMBER; BEGIN x := myfunction(); END;
A more complex example that returns 100 (10 * 10):
DECLARE x NUMBER; FUNCTION mysquare(in_y IN NUMBER) RETURN NUMBER IS BEGIN RETURN in_y * in_y; END mysquare; BEGIN dbms_output.enable; x := mysquare(10); dbms_output.put_line(x); END;
Terri gregory
source share