Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: UPDATE SET of multiple columns

Re: UPDATE SET of multiple columns

From: <Kenneth>
Date: Thu, 13 Apr 2006 18:23:46 GMT
Message-ID: <443e966a.3060062@news.inet.tele.dk>


On 13 Apr 2006 11:10:04 -0700, "DBA9999" <cdavis10717_at_comcast.net> wrote:

>I have a table with several columns that may have null values.
>
>I want to set the columns to 0 if they are null.
>
>An UPDATE statement like this below gives me a syntax error, but how
>could all the columns be set to 0 in one update statement?
>
>Thanks.
>
>C
>
>
>update DISK_STATS_TBL
>set DISKBSIZE_STAT = 0 where DISKBSIZE_STAT IS NULL,
> DISKBUSY_STAT = 0 where DISKBUSY_STAT IS NULL,
> DISKREAD_STAT = 0 where DISKREAD_STAT IS NULL,
> DISKWRITE_STAT = 0 here DISKWRITE_STAT IS NULL,
> DISKXFER_STAT = 0 where DISKXFER_STAT IS NULL,
> DISKSERV_STAT = 0 where DISKSERV_STAT IS NULL
>;
>set DISKBSIZE_STAT = 0 where DISKBSIZE_STAT IS NULL,
> *
>ERROR at line 2:
>ORA-00933: SQL command not properly ended
>

update DISK_STATS_TBL
set DISKBSIZE_STAT = nvl(DISKBSIZE_STAT,0),

	DISKBUSY_STAT  =nvl(DISKBUSY_STAT ,0),
	DISKREAD_STAT  =nvl(DISKREAD_STAT ,0),
	DISKWRITE_STAT =nvl(DISKWRITE_STAT ,0),
	DISKXFER_STAT  =nvl(DISKXFER_STAT ,0),
	DISKSERV_STAT  =nvl(DISKSERV_STAT ,0)
        DISKBSIZE_STAT =nvl(DISKBSIZE_STAT ,0)


Received on Thu Apr 13 2006 - 13:23:46 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US