There are many useful functions in the Oracle function library, such as Nvl,sign,round, which use more, the function is larger or decode this function. The use of this function is as follows:
Decode (expression, condition 1, result 1, condition 2, result 2, ...) In the middle there are several conditions and results depending on the individual, as
Decode (sign (100-20), 1,20,-1,100) means that when (100-20) is greater than zero, the result is 20, and when (100-20) is less than zero, the result is 100, of which the sign is only a function of judging the symbol.
If you want to wage adjustment to a company's employees, for 3000 of the following increase of 10%, 3000 more than 5%, then if the general practice is to judge the wages, if greater than 3000, add 5%, and less than 3000 on the plus 10%. But now that you have this decode function, you can simply use the following statement:
Select Decode (sign (salary-3000), 1,salary*1.1,-1,salary*1.05) from employee
Haha, this is easy to understand