Oracle Functions--common functions
NVL (EXPRESS1,EXPRESS2):
If the first expression is empty, the value of the second expression is displayed; If the first expression is not empty, the value of the first expression is displayed;
NVL2 (EXPRESS1,EXPRESS2,EXPRESS3);
Returns an expression of 3 if the first expression is empty, and returns an expression of 2 if the first expression is not empty;
Nullif (EXPRESS1,EXPRESS2);
If the expression 1 is the same as the expression 2, the result is null, otherwise the result is 1;
COALESCE (EXPRESS1,EXPRESS2,EXPRESS3 ...) );
The function is to return the first expression that is not empty and return NULL if all is empty. Note that all representations must be of the same type or can be converted to the same type;
Decode (condition, value 1, return value 1, value 2, return value 2, value 3, return value 3, ... value n, return value N, default value);
The meaning of the function is as follows: if "condition" equals "value 1", returns "return value 1", if "condition" equals "Value 2", returns "return value 2" ..., returns "return value n" if "condition" equals "value n", otherwise returns "default value";
case when function;
This function is similar to the if...when in the Java syntax, and its syntax is as follows:
Case conditions
When ' value 1 ' Then ' returns a value of 1 '
When ' value 2 ' Then ' returns a value of 2 '
When ' value 3 ' Then ' returns a value of 3 '
Else ' return value 4 '
End
Example:
Select
(Case S.sex
When 1 Then ' Men '
When2 Then ' female '
Else ' empty '
End
) gender
From user s
7, Concat (String 1, string 2);
The function returns the string 1 and connects the string 2 after it;
Example: Select Concat (' Yang ', ' Peng ') from dual; The return value is ' Yangpeng ';
8, Length (string);
The function returns the length of the string;