Merge help
Teradata Teradata Discussion Forums Teradata.com Discussion Forum
Visit Teradata.com
Home       Guidelines    Member List
Welcome Guest ( Login | Register )
        


This online forum is for user-to-user discussions of Teradata products, and is not an official customer support channel for Teradata. If you require direct assistance, please contact Teradata support.


Merge help Expand / Collapse
Author
Message
Posted 5/12/2008 4:17:57 AM
Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: Today @ 2:01:41 AM
Posts: 35, Visits: 291
Hi all,
when I run the below sql it giving error.
could anyone correct me, what is wrong with it.

update emp
from (select b.emp_no emp_no,b.emp_name emp_name, b.emp_code emp_code, b.salary from emp2 a,emp1 b where a.emp_no=b.emp_no) c
set salary=salary*2
where emp_no=c.emp_no
else
insert into emp
(emp_no,emp_name, emp_code, salary)
values
(c.emp_no,c.emp_name,c.emp_code,salary);

*** Failure 5565 The UPDATE specified in the UPSERT statement is a complex update.
Statement# 1, Info =485
*** Total elapsed time was 1 second.



Regards:
Monika
Post #11412
Posted 5/12/2008 9:35:33 PM
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: PAC and SFT Members
Last Login: Today @ 4:14:00 PM
Posts: 331, Visits: 538
The "UPSERT" form does not allow a FROM clause (joined update).

If using TD12.0, consider MERGE. (If you are not on TD12.0, MERGE is restricted to single-row operations - so appears unlikely to handle what you are trying to do.)

Or do it in two parts, joined UPDATE followed by INSERT ... SELECT ... WHERE NOT EXISTS
Post #11417
Posted 5/13/2008 8:46:57 AM
Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: Today @ 2:01:41 AM
Posts: 35, Visits: 291
Thanks a lot Fred Pluebell.
I have done the same which you told.
Thanks for you help.


Regards:
Monika
Post #11424
« Prev Topic | Next Topic »


Reading This Topic Expand / Collapse
Active Users: 0 ( 0 guests, 0 members, 0 anonymous members )
No members currently viewing this topic.


All times are GMT -5:00, Time now is 9:08pm

Powered By InstantForum.NET v4.1.4 © 2008
Execution: 0.047. 8 queries. Compression Disabled.