Decode () function skills in oracle

xiaoxiao2021-03-06  63

Decode () function use skills · Software environment: 1, Windows NT4.0 Oracle 8.0.42, Oracle installation path is: c: / orate · Meaning Explanation: decode (condition, value 1, translation value 1, value 2, translation Value 2, ... value n, translation value n, default value) The meaning of this function is as follows: IF condition = value 1 Then Return (translation value 1) ELSIF Condition = Value 2 Then Return (Translation value 2) ... ... ELSIF Condition = Value n Then Return (Default) END IF · How to Use: 1, Compare Sky Select Decode (SIGN (Variable 1-Variable 2), - 1, Variable 1, Variable 2) from dual; - Take a smaller value SIGN () function According to a value of 0, the positive or negative number, respectively, the number of 0, 1, -1, for example: variable 1 = 10, variable 2 = 20 SIGN ( Variable 1-Variable 2) Returns -1, Decode decoding result is "variable 1" to achieve a smaller value.

转载请注明原文地址:https://www.9cbs.com/read-111377.html

New Post(0)