update [message #600818] |
Tue, 12 November 2013 17:54 |
|
nataliafoster26
Messages: 64 Registered: October 2013
|
Member |
|
|
want to update my table
where currency_code is null and inf_src_db='aus'
this is what i have
UPDATE PREMIER.S_SALES_CENTER
SET CURRENCY_CODE='USD'
WHERE INF_SRC_DB ='AUS'
AND CURRENCY_CODE= NULL;
CREATE TABLE PREMIER.S_SALES_CENTER
(
SALES_CENTER_ID NUMBER(12) NOT NULL,
CASH_DISCOUNT NUMBER(14,2),
CURRENCY_CODE VARCHAR2(3 BYTE),
MASTER_SALES_CENTER_ID NUMBER(12),
DISPATCH_PHONE_NUM VARCHAR2(20 BYTE),
INF_SRC_DB VARCHAR2(3 BYTE) NOT NULL
)
im i doing the right way, is not working so something is wrong?
|
|
|
|
|
|
|
|
Re: update [message #600824 is a reply to message #600823] |
Tue, 12 November 2013 18:36 |
|
BlackSwan
Messages: 26766 Registered: January 2009 Location: SoCal
|
Senior Member |
|
|
SQL> @ssc
SQL> INSERT INTO S_SALES_CENTER (SALES_CENTER_ID,CURRENCY_CODE, INF_SRC_DB)
2 VALUES(1,NULL,'AUS');
1 row created.
SQL> INSERT INTO S_SALES_CENTER (SALES_CENTER_ID,CURRENCY_CODE, INF_SRC_DB)
2 VALUES(2,NULL,'AUS');
1 row created.
SQL> INSERT INTO S_SALES_CENTER (SALES_CENTER_ID,CURRENCY_CODE, INF_SRC_DB)
2 VALUES(3,NULL,'GER');
1 row created.
1 UPDATE S_SALES_CENTER
2 SET CURRENCY_CODE='USD'
3 WHERE INF_SRC_DB ='AUS'
4* AND CURRENCY_CODE IS NULL
SQL> /
2 rows updated.
|
|
|
|
|
Re: update [message #600827 is a reply to message #600826] |
Tue, 12 November 2013 18:47 |
cookiemonster
Messages: 13920 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
It's not working because, as is shown in this thread here, nothing is equal to null.
To find rows where a column is null you have to use IS NULL, not = NULL.
|
|
|
|
|
|
Re: update [message #600839 is a reply to message #600831] |
Wed, 13 November 2013 01:13 |
|
Littlefoot
Messages: 21808 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
All day long you've been updating AUS, now you switched to AEU. Is that correct?
|
|
|