Function can use Out/Inout Parameter
Can we use an OUT/INOUT parameter in a function?
Yes of course.
A Small example:
CREATE OR REPLACE FUNCTION TEST(A IN NUMBER, B IN OUT NUMBER,
C OUT NUMBER) RETURN NUMBER IS
D NUMBER(3);
BEGIN
B := B + A;
C := B;
D := A + B + C;
RETURN D;
END;
DECLARE
A1 NUMBER(3) := 10;
B1 NUMBER(3) := 20;
C1 NUMBER(3) := 30;
D1 NUMBER(3) := 40;
BEGIN
D1 := TEST(A1,B1,C1);
DBMS_OUTPUT.PUT_LINE(A1 || ' ' || B1 || ' ' || C1 || ' ' || D1);
END;
Yes of course.
A Small example:
CREATE OR REPLACE FUNCTION TEST(A IN NUMBER, B IN OUT NUMBER,
C OUT NUMBER) RETURN NUMBER IS
D NUMBER(3);
BEGIN
B := B + A;
C := B;
D := A + B + C;
RETURN D;
END;
DECLARE
A1 NUMBER(3) := 10;
B1 NUMBER(3) := 20;
C1 NUMBER(3) := 30;
D1 NUMBER(3) := 40;
BEGIN
D1 := TEST(A1,B1,C1);
DBMS_OUTPUT.PUT_LINE(A1 || ' ' || B1 || ' ' || C1 || ' ' || D1);
END;
No comments:
Post a Comment