Home » SQL & PL/SQL » SQL & PL/SQL » Please correct the update statement (oracle 11g)
Please correct the update statement [message #596606] Wed, 25 September 2013 03:06 Go to next message
ajaykumarkona
Messages: 399
Registered: August 2010
Senior Member
Hi Experts,

Please correct the below update statement.

  update customer c    
     set c.sal_amt = m.sal,
         c.mar_amt = m.mar,
         c.daily_amt = m.daily   
  from   
   customer c,   
   merchant m   
  where   
   c.c_id = m.t_id   
   and c.unit = m.unit     
   and c.band = m.band
   and c.loc = m.loc   
   and c.sid = :new_Id; --variable


Please help me.

Thanks.
icon5.gif  Re: Please correct the update statement [message #596609 is a reply to message #596606] Wed, 25 September 2013 03:15 Go to previous messageGo to next message
Michel Cadot
Messages: 60011
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Quote:
Please correct the below update statement.


To do what? What is the problem?

Re: Please correct the update statement [message #596614 is a reply to message #596609] Wed, 25 September 2013 03:24 Go to previous messageGo to next message
ajaykumarkona
Messages: 399
Registered: August 2010
Senior Member
I am getting below error.

ORA-00933: SQL command not properly ended.

Thanks.
icon2.gif  Re: Please correct the update statement [message #596618 is a reply to message #596614] Wed, 25 September 2013 03:27 Go to previous messageGo to next message
Michel Cadot
Messages: 60011
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

If you put some comment after the ended ";" you generate a syntax error.
Nothing should follow this ";"
Re: Please correct the update statement [message #596684 is a reply to message #596618] Wed, 25 September 2013 12:01 Go to previous message
Bill B
Messages: 1141
Registered: December 2004
Senior Member
 update customer c   
set (c.sal_amt,c.mar_amt,c.daily_amt) =
(select m.sal,m.mar,m.daily   
  from   
  merchant m   
  where   
   c.c_id = m.t_id   
   and c.unit = m.unit     
   and c.band = m.band
   and c.loc = m.loc)   
  where c.sid = :new_Id;


[Updated on: Wed, 05 March 2014 01:05] by Moderator

Report message to a moderator

Previous Topic: how to write LAST_INSERT_ID() in oracle
Next Topic: Error in cursor
Goto Forum:
  


Current Time: Sun Dec 21 08:47:17 CST 2014

Total time taken to generate the page: 0.10956 seconds