Oracle PL/SQL/Numeric Math Functions/greatest — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Версия 13:45, 26 мая 2010
Содержание
GREATEST(12*6,148/2,73) LEAST(12*6,148/2,73)
SQL>
SQL> select greatest(12*6,148/2,73)
2 , least (12*6,148/2,73)
3 from dual;
GREATEST(12*6,148/2,73) LEAST(12*6,148/2,73)
----------------------- --------------------
74 72
SQL>
SQL>
GREATEST() returns the greatest of the list of expressions.
SQL>
Syntax: GREATEST(<expression1>,<expression2>. . . <expression>)
SQL>
SQL> SELECT
2 GREATEST("ALEX","WALTER","PHILLIP") names,
3 GREATEST(10,20,135) numbers
4 FROM dual;
NAMES NUMBERS
------ ----------
WALTER 135
SQL>
SQL>
SQL>
select greatest(
SQL>
SQL> select greatest( 1, 5, 10 )
2 from dual;
GREATEST(1,5,10)
----------------
10
1 row selected.
SQL>
SQL> --
select greatest( "A", "a" )from dual;
SQL>
SQL> select greatest( "A", "a" )from dual;
G
-
a
1 row selected.
SQL>
SQL> --
select greatest( "ONE", 1 )
SQL>
SQL> select greatest( "ONE", 1 )
2 from dual;
GRE
---
ONE
1 row selected.
SQL>
SQL> --
This script demonstrates the Greatest functions
SQL>
SQL> SET SERVEROUTPUT ON
SQL> DECLARE
2 v_char VARCHAR2(10);
3 v_number NUMBER(10);
4 BEGIN
5
6 v_char := GREATEST("A", "B", "C");
7 v_number := GREATEST(1,2,3);
8
9 DBMS_OUTPUT.PUT_LINE("Greatest Character: "||v_char);
10 DBMS_OUTPUT.PUT_LINE("Greatest Number: "||v_number);
11
12 END;
13 /
Greatest Character: C
Greatest Number: 3
PL/SQL procedure successfully completed.
SQL>
SQL>