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

Home -> Community -> Usenet -> c.d.o.server -> Re: Informix2Oracle Migration Question

Re: Informix2Oracle Migration Question

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: 1997/07/08
Message-ID: <33c27516.13704275@newshost>#1/1

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 sequence mySeq
/

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



Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Tue Jul 08 1997 - 00:00:00 CDT

Original text of this message

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