using INSERT and REFERENCING the same table via a sub-query?
Posted in 1995
I am trying to insert rows from a TEMP table into a MSTR table
*only* if *col01 and col02* of the TEMP table DOES NOT exist
in the MSTR table. When I run the the SQL below, I receive an
error from Informix that you cannot INSERT (or UPDATE) a table
that you are *also* referencing in the subquery. I tried to create
a view of the MSTR table and use the view name in the subquery
but, still receive the same error. This works in Oracle and DB2 but
not in Informix. I want to avoid to create another temp table and insert
rows from the MSTR table and run it that way.. Any ideas? Please
email to: ldeckard@databank.com Thanks! Lenny Deckard.
insert into MSTR (col01,
col02,
col03,
col04,
col04,
col05)
select * from TEMP
where (col01||col02) not in
(select col01||col02 from MSTR);