Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Informix2Oracle Migration Question
On Tue, 08 Jul 1997 17:07:13 +0200, Vicente Briz <vbriz_at_enyca.es> wrote:
>Hi,
>
>I'm migrating a database from Informix to Oracle and I'm trying to find
>a way it seems as mosts transparent to the aplicaction level as
>possible. Informix support the SERIAL datatype for generate unique
>integer identifier for each row in a table, the identifier generation
>took place in the server that why any of my insert clause don't include
>this field.
>
>In Oracle is there any way to bind a sequence object to a table colummn?
>I've been trying to do it in the before insert trigger but the server
>don't allow me to write directly to the table that generate the trigger.
>At this time I can access a system temporary table (like inserted or
>updated) an update the value for the "serial" colummn?
>
You would:
create table T
( pk int primary key, ....
create trigger myTrig
on T
before insert
for each row
begin
select mySeq.nextval into :new.PK from dual;
end;
/
Don't try to insert/update the table, simply reset the values in the :new bind record to the trigger. You can do this in a before/for each row trigger.
>TIA,
>Vicente Briz
>e-mail: vbriz_at_enyca.es
Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Bethesda MD
http://govt.us.oracle.com/ -- downloadable utilities