Use least() to limit the value : least « Numeric Math Functions « Oracle PL / SQL

Home
Oracle PL / SQL
1.Aggregate Functions
2.Analytical Functions
3.Char Functions
4.Constraints
5.Conversion Functions
6.Cursor
7.Data Type
8.Date Timezone
9.Hierarchical Query
10.Index
11.Insert Delete Update
12.Large Objects
13.Numeric Math Functions
14.Object Oriented Database
15.PL SQL
16.Regular Expressions
17.Report Column Page
18.Result Set
19.Select Query
20.Sequence
21.SQL Plus
22.Stored Procedure Function
23.Subquery
24.System Packages
25.System Tables Views
26.Table
27.Table Joins
28.Trigger
29.User Previliege
30.View
31.XML
Oracle PL / SQL » Numeric Math Functions » least 




Use least() to limit the value
  


SQL> create table salary
  2  grade      NUMBER(2)   constraint S_PK primary key
  3  , lowerlimit NUMBER(6,2)
  4  , upperlimit NUMBER(6,2)
  5  , bonus      NUMBER(6,2)
  6  , constraint S_LO_UP_CHK check(lowerlimit <= upperlimit)
  7  ;

Table created.

SQL>
SQL> insert into salary values (1,  700,1200,   0);

row created.

SQL> insert into salary values (21201,1400,  50);

row created.

SQL> insert into salary values (31401,2000100);

row created.

SQL> insert into salary values (42001,3000200);

row created.

SQL> insert into salary values (53001,9999500);

row created.

SQL>
SQL> select grade + 5
  2  ,      lowerlimit + 2300
  3  ,      least(9999,upperlimit + 2300)
  4  ,      500
  5  from   salary;

   GRADE+LOWERLIMIT+2300 LEAST(9999,UPPERLIMIT+2300)        500
---------- --------------- --------------------------- ----------
         6            3000                        3500        500
         7            3501                        3700        500
         8            3701                        4300        500
         9            4301                        5300        500
        10            5301                        9999        500

SQL>
SQL>
SQL> drop table salary;

Table dropped.

   
    
  














Related examples in the same category
1.select least( 'X', 'x' ) from dual;
2.select least( 'A', 'B', 'C' ) from dual;
3.This script demonstrates the Least functions
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.