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






Return value from a function

   
SQL> -- The mypi function.
SQL> CREATE OR REPLACE FUNCTION mypi
  2      RETURN NUMBER IS
  3  BEGIN
  4       NULL;
  5       RETURN 3.14;
  6  END mypi;
  7  /

Function created.

SQL>
SQL> -- Verifying the mypi function.
SQL> BEGIN
  2       DBMS_OUTPUT.PUT_LINE('value of pi is ' || mypi());
  3  END;
  4  /
value of pi is 3.14

PL/SQL procedure successfully completed.

SQL>

           
         
    
    
  








Related examples in the same category

1.Return varchar2 value from function
2.Function return Integer
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