Define and use function in select clause : Function Definition « Stored Procedure Function « Oracle PL / SQL






Define and use function in select clause

   
SQL>
SQL>
SQL> -- The SS_THRESH function.
SQL> CREATE OR REPLACE FUNCTION ss_thresh
  2  RETURN NUMBER AS
  3    x     NUMBER(9,2);
  4  BEGIN
  5    x := 65400;
  6    RETURN x;
  7  END;
  8  /

Function created.

SQL>
SQL> select ss_thresh() from dual;

SS_THRESH()
-----------
      65400

SQL>

           
         
    
    
  








Related examples in the same category

1.Define and call a function
2.A stored function.
3.Use user-defined function in if statement
4.Recursive function
5.function with no return type
6.Recursive function Factorial
7.A local function
8.Recursive function 2
9.demonstrates the behavior of the DETERMINISTIC keyword.
10.Function to convert celsius to fahrenheit
11.Function to convert fahrenheit to celsius
12.A function is executed like any other SQL built-in function:
13.Count Employee from a function and return value back
14.How stored functions can be called from SQL
15.Raise exception from inner function