STORED PROCEDURE THAT COMPUTES THE GREATEST OF THE NUMBERS IN ORACLE?.
SQL>
CREATE OR REPLACE FUNCTION BIG(A NUMBER, B
NUMBER, C NUMBER)RETURN NUMBER AS
2 BEGIN
3 IF(A>B AND A>C)
4 THEN RETURN A;
5 ELSIF (A<B AND B>C) THEN
6 RETURN B;
7 ELSE
8 RETURN C;
9 END IF;
10 END BIG;
11 /
Function created.
SQL>
SELECT BIG (14,20,50) FROM DUAL;
BIG(14,20,50)
-------------
50
PL/SQL
procedure successfully completed.
SQL>
START GREATEST.SQL;
Function created.
SQL>
SELECT BIG (4,8,20) FROM DUAL;
BIG(4,8,20)
-------------
20
PL/SQL procedure successfully completed.
Comments
Post a Comment