First I say what is Oracle's function, once a Daniel, let me talk about the familiar Oracle function, I was confused, thought "What Oracle function Ah, is not those SQL statements," then I actually uttered a select answer, he almost angry, Repeatedly stressed: "I said is the Oracle function", later he said, function can be understood as with parentheses (), then I slowly sensible after, often Baidu Oracle function, every time there is an interview or review, I have deliberately practiced SQL function.
Use the NVL function to handle null values:
Eg: Calculates the annual income of each person including monthly and year-end allowances
(1) Annual salary is (monthly) *12+ performance;
(2) but performance (comm) has a null value, and when Comm is a null value, the result of the monthly + performance is also a null value;
(3) So, when Comm is a null value, it needs to be treated as a zero. Which function can win this task? NVL ();
(4) NVL () is equivalent to an IF. Else statement, if the field is not empty, take the original value;
Select Ename,sal*12 +NVL (comm,0) as annual salary from EMP;
The Oracle NVL () function handles null values