I. Software Environment
1. windows nt4.0 + oracle 8.0.4
2. oracle installation path: c: \ orant
Ii. Meaning
Iii. Usage
1. Compare the size
Select decode (sign (variable 1-variable 2),-1, variable 1, variable 2) from dual; -- smaller value
The sign () function returns 0, 1, and-1 respectively based on a value of 0, positive, or negative.
For example:
Variable 1 = 10, variable 2 = 20
Then sign (variable 1-variable 2) returns-1, and the decode decoding result is "variable 1", achieving the goal of getting a smaller value.
2. Table and View Structure Conversion
There is a sales table sale with the following structure:
Data to be converted to the following structure:
The SQL statement for structure conversion is:
Related Articles]
- Easily modify the size of an Oracle database table
- Hints adjustment mechanism used by Oracle
- Oracle remote replication and Remote Disaster Recovery classic Analysis