Converts null to an actual value Datatypes that can be used are date, character, and number. Datatypes must match NVL(comm,0) NVL(hiredate,'01-JAN-97') NVL(job,'No Job Yet') eg : SELECT ename, sal, comm, (sal*12)+NVL(comm,0) FROM emp; ENAME SAL COMM (SAL*12)+NVL(COMM,0) ---------- --------- --------- -------------------- KING 5000 60000 BLAKE 2850 34200 CLARK 2450 29400 JONES 2975 35700 MARTIN 1250 1400 16400 ALLEN 1600 300 19500 ... 14 rows selected.
为什么我的table 中栏位是null值,但我用nvl 之后还是返回null值。 SQL> select nvl(icblas,'addd') from hrshicb where icbwno='0029';NVL(ICBLAS,'ADDD') --------------------------------------------------
NVL(commission_pct,0) -- 如果commission_pct为空(NULL),返回0。
Datatypes that can be used are date, character, and number.
Datatypes must match
NVL(comm,0)
NVL(hiredate,'01-JAN-97')
NVL(job,'No Job Yet')
eg :
SELECT ename, sal, comm, (sal*12)+NVL(comm,0)
FROM emp;
ENAME SAL COMM (SAL*12)+NVL(COMM,0)
---------- --------- --------- --------------------
KING 5000 60000
BLAKE 2850 34200
CLARK 2450 29400
JONES 2975 35700
MARTIN 1250 1400 16400
ALLEN 1600 300 19500
...
14 rows selected.
SQL> select nvl(icblas,'addd') from hrshicb where icbwno='0029';NVL(ICBLAS,'ADDD')
--------------------------------------------------