Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> SQL (and sqlplus) Help - Null values and calculated columns
I am somewhat of a newbie to sql. I am having trouble adding two
columns b/c of null values. I am trying to update columns that are
null to 0 and then sum up a calculated column. see below for sql and
report generated. Image Cost and Product Cost cannot be added when
there is a null value. My update to 0 is not working, as well as my
attempt to compute sum on the last column (computed). Any help
appreciated - THANKS!
(this column heading does not work)
COLUMN X_IMAGE_COST+X_PRICE_LIST_COST FORMAT $999,999.99 HEADING
'TOTALS';
rem
(this compute sum on calculated column does not work)
COMPUTE SUM OF X_PRICE_LIST_COST+X_IMAGE_COST ON REPORT;
rem
UPDATE S_PROD_INT
SET X_IMAGE_COST = 0 WHERE X_IMAGE_COST is null; UPDATE S_PRI_LST SET X_PRICE_LIST_COST = 0 WHERE X_PRICE_LIST_COST is null;
XYZ Corporation Product Cost ReportDEPARTMENT
----- ------ ----------- ----------- ------------------------------- Martian D012 null $187.50 null Martian D345 $92.50 $187.50 280 Martian A123 null $125.00 null Martian B456 $35.00 $125.00 160 Martian C789 $92.50 $125.00 217.5 --------- ---------- sum $220.00 $750.00
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Tue Dec 14 1999 - 20:17:52 CST
![]() |
![]() |