Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Use a package function inside a select of the same package

600198Feb 6 2008 — edited Feb 7 2008
Hi.

How can i use a function defined inside a package, with a select used inside that same package ?

Example

... package example

CREATE OR REPLACE PACKAGE BODY pkg_example
AS
FUNCTION sum_two_values(p_val1 NUMBER,p_val2 NUMBER) RETURN NUMBER
IS
BEGIN
RETURN p_val1 + p_val2;
END sum_two_values;

FUNCTION use_another_function_example RETURN VARCHAR2
IS
v_value NUMBER;
BEGIN
SELECT sum_two_values(2,2) INTO v_value FROM dual;
RETURN 'waaaazzzzupppppp'
END use_another_function_example;

END pkg_example;
/

This will not work
-- SELECT sum_two_values(2,2) INTO v_value FROM dual;

How can i call a function inside a select statement, a function of the same package where the query is being called.

(i have Oracle 9.2x)
Cheers.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 6 2008
Added on Feb 6 2008
14 comments
1,683 views