Identify DML Error

MERGE INTO SAS F
USING (SELECT PRODID, PRODID+10 F, DESCRIP FROM
PRODUCT) L
ON (F.PRODID=L.PRODID)
WHEN MATCHED THEN
UPDATE SET F.PRODID=L.F
WHEN NOT MATCHED THEN
INSERT VALUES (L.F, L.DESCRIP)

Why does the above give error?

Questions by svp.kiran

Showing Answers 1 - 6 of 6 Answers

Lakshmi84

  • Aug 12th, 2009
 

I think Error lies in the following statement

INSERT VALUES (L.F, L.DESCRIP) 

THE STATEMENT SHOULD BE LIKE THIS

  INSERT (F.PRODID,F.DESCRIP)
VALUES(L.F,L.DESCRIP)

  Was this answer useful?  Yes

debjit20

  • Apr 5th, 2010
 

The Error will be:

Columns used in ON condition cannot be used in UPDATE.
You cannot update the same column which you are using in the ON clause.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions