Function to convert fahrenheit to celsius : Function Definition « Stored Procedure Function « Oracle PL / SQL






Function to convert fahrenheit to celsius

   


SQL> CREATE OR REPLACE FUNCTION fahrenheit_to_celsius (degree NUMBER) RETURN NUMBER IS
  2      buffer NUMBER;
  3
  4  BEGIN
  5     buffer := (5/9) * (degree - 32);
  6     RETURN buffer;
  7  END fahrenheit_to_celsius;
  8
  9  /

Function created.

SQL>
SQL>

   
    
    
  








Related examples in the same category

1.Define and call a function
2.Define and use function in select clause
3.A stored function.
4.Use user-defined function in if statement
5.Recursive function
6.function with no return type
7.Recursive function Factorial
8.A local function
9.Recursive function 2
10.demonstrates the behavior of the DETERMINISTIC keyword.
11.Function to convert celsius to fahrenheit
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