Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to do an insert with a select statement, with unique values

Stanley Lee-OracleNov 11 2010 — edited Nov 12 2010
Hi,

I have an insert statement like this

INSERT INTO TABLEA (ID, zzz
SELECT sequence.nextval, zzz FROM TABLEB

The problem is TABLEA won't allow any duplicates and TABLEB will return duplicates. Yet I can't use the distinct keyword since I am using a sequence.

Thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 10 2010
Added on Nov 11 2010
19 comments
320 views