Function without parameter : Parameters « Function Procedure Packages « Oracle PL/SQL Tutorial






SQL> set serveroutput on
SQL> set echo on
SQL>
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>
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>








27.14.Parameters
27.14.1.Defining Formal Parameters
27.14.2.There are three types of formal parameters in subprograms: IN, OUT, and IN OUT.
27.14.3.Define function with NUMBER type parameter
27.14.4.Function without parameter
27.14.5.Use IF/ELSIF/ELSE to verify the input parameter
27.14.6.Use ROWTYPE as the parameter
27.14.7.Passing parameters to procedures
27.14.8.Using Named Notation
27.14.9.Use mixed notation to avoid the second parameter, but keep the first and third
27.14.10.Parameter Modes
27.14.11.Positional Notation
27.14.12.Positional vs. named parameter passing.
27.14.13.Parameter Default Values
27.14.14.Specifying procedure or function parameters Positional notation
27.14.15.Table collection type parameter
27.14.16.Mixed Name and Position Notation Calls