PLSQL - Use DECODE determines the SIGN condition is greater than zero

Summary: PLSQL - Use the SIGN to DECODE determination condition is greater than zero


Before <PLSQL & T-SQL - PLSQL have DECODE, MS SQL there CASE WHEN> This has to introduce the use of DECODE, which today is used to determine whether the SIGN DECODE coupled condition is greater than zero ...

Code:

the SELECT DECODE ( SIGN (100-80), 1, 100-80 , -1, 0) as Result FROM DUAL;

SELECT DECODE (SIGN (100-120), 1, 100-80, -1, 0) as Result FROM DUAL;

Results:



Reference:
Usage oracle decode function in
Oracle / PLSQL: Sign Function


Original: Large column  PLSQL - DECODE used to determine whether the SIGN condition is greater than zero


Guess you like

Origin www.cnblogs.com/chinatrump/p/11505615.html
Recommended