Multitable Insert

So, let’s start with two normal inserts:

insert into tab1
select 1,1,’first’ from dual

and

insert into tab2
select 1,1,’first’ from dual

this work fine, but we got Oracle 9 and 10 nowadays so we can:

Insert all
into tab1
into tab2
select 1,1,’first’ from dual

and this give us:
ORA-00918: column ambiguously defined

:|

A bit strange.

Then thing goes worst when:

- you run the query on another set up and: 2 row(s) inserted

- you rewrite the query adding aliases to the numbers 1 (i.e. select 1 as col1, 1 as col2) and find out that it works!

It’s a weird thing!

:D

Leave a Reply

You must be logged in to post a comment.