Return varchar2 value from function : Function Return « Stored Procedure Function « Oracle PL / SQL






Return varchar2 value from function

    
SQL>
SQL> CREATE OR REPLACE FUNCTION CallFunc(p1 IN VARCHAR2)
  2    RETURN VARCHAR2 AS
  3  BEGIN
  4    DBMS_OUTPUT.PUT_LINE('CallFunc called with ' || p1);
  5    RETURN p1;
  6  END CallFunc;
  7  /

Function created.

SQL> VARIABLE v_Output VARCHAR2(50);
SQL> CALL CallFunc('Hello!') INTO :v_Output;
CallFunc called with Hello!

Call completed.

SQL> PRINT v_Output

V_OUTPUT
--------------------------------------------------------------------------------
Hello!

   
    
    
  








Related examples in the same category

1.Function return Integer
2.Return value from a function
3.Use function return value in select statement
4.Save the returning value from a procedure to a variable
5.RETURN statement.
6.Multiple RETURN Statements
7.Return a type
8.Concatenates two strings into one:
9.Return a varray from a function
10.Append result from generator function to a table
11.We use user function in DML statements
12.This script demonstrates using a record type as a function return value
13.Use function to check passwords
14.Use user-defined function to combine and format columns