On Tue, 11 May 1999, Parry, Brian S wrote:
> Ari,
> I'm very new to Oracle. I've used MS SQL Server for 3 years. I'm
> trying to update one table with data from another table where they have some
> matching information. I keep getting the following error:
>
> SQLWKS> UPDATE INCOMING_LEAD
> 2> SET INCOMING_LEAD.DEPARTMENT_CD = OFFER_INPUT_KEYCODE.DEPARTMENT_CD,
> 3> INCOMING_LEAD.PROGRAM_CD = OFFER_INPUT_KEYCODE.PROGRAM_CD,
> 4> INCOMING_LEAD.EFFORT_CD = OFFER_INPUT_KEYCODE.EFFORT_CD,
> 5> INCOMING_LEAD.OFFER_CD = OFFER_INPUT_KEYCODE.OFFER_CD
> 6> FROM OFFER_INPUT_KEYCODE
> 7> WHERE OFFER_INPUT_KEYCODE.INPUT_KEYCODE =
> INCOMING_LEAD.PROMO_INITIAL_KEYCODE
>
> FROM OFFER_INPUT_KEYCODE
> *
> ORA-00933: SQL command not properly ended
> Can you tell me what I am doing wrong?
> Thank you very much for your help,
> Brian
> brian.parry@eds.com
>
In Oracle, the syntax is:
UPDATE INCOMING_LEAD
SET (INCOMING_LEAD.DEPARTMENT_CD, INCOMING_LEAD.PROGRAM_CD,
INCOMING_LEAD.EFFORT_CD, INCOMING_LEAD.OFFER_CD) =
(SELECT OFFER_INPUT_KEYCODE.DEPARTMENT_CD,
OFFER_INPUT_KEYCODE.PROGRAM_CD, OFFER_INPUT_KEYCODE.EFFORT_CD,
OFFER_INPUT_KEYCODE.OFFER_CD
FROM OFFER_INPUT_KEYCODE
WHERE OFFER_INPUT_KEYCODE.INPUT_KEYCODE =
INCOMING_LEAD.PROMO_INITIAL_KEYCODE)
/
You basically do one inner select and join the two tables in the inner
select's WHERE clause.
Best regards,
-Ari Kaplan
Independent Oracle DBA Consultant
<-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><->
<-> For 295+ Oracle tips, visit my Web Page: <->
<-> <->
<-> www.arikaplan.com <->
<-> <->
<-> email: akaplan@interaccess.com <->
<-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><->
Back to Ari Kaplan's Home Page