Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: insert into ORA-00001 unique constraint on rowid
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.orgReceived on Wed Oct 03 2007 - 01:55:53 CDT