Home » SQL & PL/SQL » SQL & PL/SQL » Issue with UPDATE
Issue with UPDATE [message #203655] Thu, 16 November 2006 00:00 Go to next message
gkrishn
Messages: 506
Registered: December 2005
Location: Putty a dark screen
Senior Member
EMPLOYEE table has following records .

NAME AGE D
-------------------- ---------- -
rajiv 24 C
26 C

SQL> update emp
2 set NAME='JOHN'
3 where NAME='NULL';

0 rows updated.

SQL> update emp
2 set NAME='JOHN'
3 where AGE=26;

1 row updated.

Why the first statement failed ???
Re: Issue with UPDATE [message #203657 is a reply to message #203655] Thu, 16 November 2006 00:04 Go to previous messageGo to next message
dhananjay
Messages: 635
Registered: March 2002
Location: Mumbai
Senior Member
hi,

it's because of
Quote:
'='
.change it to
Quote:
is null



regards,
Re: Issue with UPDATE [message #203664 is a reply to message #203655] Thu, 16 November 2006 00:16 Go to previous messageGo to next message
pravin3032
Messages: 51
Registered: November 2006
Location: eARTH
Member
hi
use this query ...

UPDATE EMP
SET NAME = 'JOHN'
WHERE NAME IS NULL ;
Re: Issue with UPDATE [message #203687 is a reply to message #203655] Thu, 16 November 2006 00:55 Go to previous messageGo to next message
gkrishn
Messages: 506
Registered: December 2005
Location: Putty a dark screen
Senior Member
ok got it.
Oracle is treating NULL as soemthing diff.Thnx
Re: Issue with UPDATE [message #203688 is a reply to message #203687] Thu, 16 November 2006 00:58 Go to previous message
vamsi kasina
Messages: 2107
Registered: October 2003
Location: Riyadh, Saudi Arabia
Senior Member
Yes. it does.

Just want to add something.
NULL and 'NULL' are also different.

By
Vamsi
Previous Topic: using variable inside a stored proc
Next Topic: ora-01426 numeric overflow
Goto Forum:
  


Current Time: Sat Dec 03 18:08:12 CST 2016

Total time taken to generate the page: 0.30422 seconds