Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Questions about INSERT with a subquery SELECT
Oracle will stop at the duplicate record and rollback the transaction.
-- Niall Litchfield Oracle DBA Audit Commission UK ***************************************** Please include version and platform and SQL where applicable It makes life easier and increases the likelihood of a good answer ****************************************** "moonfull" <moonfull_at_hotmail.com> wrote in message news:ec2e8e7.0206070613.67487c8e_at_posting.google.com...Received on Fri Jun 07 2002 - 09:54:12 CDT
> Hi everyone,
>
> My question is when i do an INSERT query having a subquery SELECT and
> one of inserted rows founds duplicate in the inserted table. Will
> Oracle just stop the query and return SQLCODE as duplicate record? or
> it will add in the new records and just bypass the duplicates?
>
> Example:
> INSERT INTO TAB1
> SELECT COL1,
> COL2,
> 'N',
> COL3
> FROM TAB2
> WHERE COL1 = 'A'
>
> The COL1 and COL2 are PK of TAB1. I use this query to avoid using the
> cursor to fetch and do INSERT for each record in my program.
>
> Any reply will be appreciated.
> Thanks,
> Tran.
![]() |
![]() |