Home » SQL & PL/SQL » SQL & PL/SQL » Help needed with update
Help needed with update [message #412314] Wed, 08 July 2009 11:27 Go to next message
ora1980
Messages: 251
Registered: May 2008
Senior Member
create table tmp_1(code varchar2(5),id varchar2(10),TYPE VARCHAR2(30))

I have data in this tmp_1, I have another table, tbl_main with above
3 columns + extra columns.

I need to update type column of tbl_main with values of TYPE
from tmp_1, for only the codes and ids
stored in tmp_1

I tried this:

update tbl_main a set TYPE = select type from tmp_1 b )
where a.code = b.code and a.id = b.id

it failed
Re: Help needed with update [message #412320 is a reply to message #412314] Wed, 08 July 2009 12:02 Go to previous messageGo to next message
ashoka_bl
Messages: 398
Registered: November 2006
Location: Bangalore
Senior Member

Quote:
it failed



Yeah its a real mystery,Even we don't know because we dont have the error message,

Post DDL/DML/Test Case and Error Message,

update tbl_main a set TYPE = select type from tmp_1 b ) 
where a.code = b.code and a.id = b.id


It even contains Syntactical errors apart from logical errors !!We can only predict it.
Re: Help needed with update [message #412349 is a reply to message #412314] Wed, 08 July 2009 16:50 Go to previous message
ora1980
Messages: 251
Registered: May 2008
Senior Member
thanks, I used a merge instead...
Previous Topic: Compare data and insert unique data (merged)
Next Topic: replace the character based on the positions (merged)
Goto Forum:
  


Current Time: Wed Dec 07 05:01:56 CST 2016

Total time taken to generate the page: 0.15011 seconds