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: insert into ORA-00001 unique constraint on rowid

Re: insert into ORA-00001 unique constraint on rowid

From: DA Morgan <damorgan_at_psoug.org>
Date: Tue, 02 Oct 2007 23:55:53 -0700
Message-ID: <1191394540.727531@bubbleator.drizzle.com>


jobs wrote:
> Hi.
>
> We have this table that has a key call id_row where apparently, rowid
> is inserted.
>
> I'm trying to insert into that table from another table.
>
> What's the best way to get and insert the unique rowid?
>
> my insert looks like this
>
> insert into tab1 g (g.x,g.y,g.z,g.id_row) select b.x,b.y,b.z,b.id_row
> from tab2 b where not exists (
> select x from tab1 a where a.x=b.x)
>
> I guess I'm not sure, how do pass rowid of g into to g.id_row???
>
> Thanks for any help or information.

Depends on what the rowid is. If it is the rowid you get from doing this query:

SELECT rowid
FROM tab1;

Then you can get it the same way but you'd be very well advised to not do so and change the design. Rowid's can change and your storage of them a train wreck waiting to happen.

If it is something else, for example created by a sequence then use sequence_name.NEXTVAL.

-- 
Daniel A. Morgan
University of Washington
damorgan_at_x.washington.edu (replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Received on Wed Oct 03 2007 - 01:55:53 CDT

Original text of this message

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