Home » SQL & PL/SQL » SQL & PL/SQL » Missing keyword to update related column
Missing keyword to update related column [message #428023] Mon, 26 October 2009 21:24 Go to next message
carillpower
Messages: 48
Registered: April 2009
Location: malaysia
Member

Hi all, i have a doubt here...i have a code that will change a data which use for relate between 2 tables. Here's are the code


update (
select a.ssn a_ssn,b.emplid b_emplid,b.ssn b_ssn,
CASE
  WHEN a.ssn = a.ssn THEN a.ssn = b.emplid
  ELSE a.ssn = b.ssn
END a_change
from ps_A a, ps_B b
where b.ssn = a.ssn)
set a_ssn = a_change



But currently it shows an error like this

ERROR at line 4:
ORA-00905: missing keyword

Kindly if there's any suggestion on this, it would be helpful
Re: Missing keyword to update related column [message #428028 is a reply to message #428023] Mon, 26 October 2009 22:39 Go to previous messageGo to next message
BlackSwan
Messages: 25033
Registered: January 2009
Location: SoCal
Senior Member
>Kindly if there's any suggestion on this, it would be helpful
Because no WHERE exists on actual UPDATE, every row is changed

Re: Missing keyword to update related column [message #428036 is a reply to message #428023] Mon, 26 October 2009 23:40 Go to previous message
Frank
Messages: 7880
Registered: March 2000
Senior Member
carillpower wrote on Tue, 27 October 2009 03:24
update (
select a.ssn a_ssn,b.emplid b_emplid,b.ssn b_ssn,
CASE
  WHEN a.ssn = a.ssn THEN a.ssn = b.emplid
  ELSE a.ssn = b.ssn
END a_change



What's the "THEN a.ssn = b.emplid" part?
replace it with "THEN b.emplid". This also goes for the ELSE branch, which of course will never be hit as long as a.ssn has a value.

[Updated on: Mon, 26 October 2009 23:41]

Report message to a moderator

Previous Topic: Removing CSV File Using UTL_FILE
Next Topic: Transposing distinct row entities into columns while counting them
Goto Forum:
  


Current Time: Sat Dec 03 01:16:52 CST 2016

Total time taken to generate the page: 0.18870 seconds