Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Questions about INSERT with a subquery SELECT

Re: Questions about INSERT with a subquery SELECT

From: Niall Litchfield <n-litchfield_at_audit-commission.gov.uk>
Date: Fri, 7 Jun 2002 15:54:12 +0100
Message-ID: <3d00c914$0$233$ed9e5944@reading.news.pipex.net>


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...

> 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.
Received on Fri Jun 07 2002 - 09:54:12 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US