Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> to_char, to_number, or none?
--This works fine, inserts zeros when the Commission is Null
SELECT DEPT_ID "Dept", UPPER(LAST_NAME)||' '||FIRST_NAME "Employee Name"
, SALARY, salary*12 , NVL(COMMISSION_PCT*.01, 0) "Commission"
FROM S_EMP, S_DEPT, S_REGION
WHERE S_DEPT.ID IN (44, 45, 50)
AND S_EMP.DEPT_ID = S_DEPT.ID
AND S_REGION.ID = S_DEPT.REGION_ID
ORDER BY DEPT_ID;
--This does not work, I try to_char, to_number and did not have any
success. I need to display the 'n/a', but the fiels datatype is
NUMBER(4.2). Please help if you can.
SELECT DEPT_ID "Dept", UPPER(LAST_NAME)||' '||FIRST_NAME "Employee Name"
, SALARY, salary*12 , NVL(COMMISSION_PCT*.01, 'n/a') "Commission"
FROM S_EMP, S_DEPT, S_REGION
WHERE S_DEPT.ID IN (44, 45, 50)
AND S_EMP.DEPT_ID = S_DEPT.ID
AND S_REGION.ID = S_DEPT.REGION_ID
ORDER BY DEPT_ID;
Sebastian Santos <sebas_at_shaw.wave.ca>
Received on Fri Feb 05 1999 - 00:06:08 CST
![]() |
![]() |