Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback, please email oracle-forums_moderators_us@oracle.com

Issue while inserting records with union of select statements records

user11282491Mar 21 2014 — edited Mar 21 2014

Hi

I have a siuation with the below example. I have table like this

create table t1(col 1 interger , col2 primary key, col3)

Now im trying to insert data into using union of multiple select statments and my query goes like this

insert into t1(col1, col2,col3)

select seqname.nexval,A,B from

(select A, B from TT1

union

Select A, B from T2

union

Select A, B from T3)

As I know union should remove duplicates and my insert statement should work fine without any duplicates. But rurnning the above query is giving unique constraint voilated error. So can anybody suggest where my assumption is going wrong

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 18 2014
Added on Mar 21 2014
3 comments
133 views