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: INFORMIX Vs.ORACLE

Re: INFORMIX Vs.ORACLE

From: Joel Garry <jgarry_at_my-deja.com>
Date: Thu, 09 Dec 1999 23:06:13 GMT
Message-ID: <82pcl1$p6o$1@nnrp1.deja.com>


In article <384EA871.416AB562_at_miel.mot.com>,   hpandu <hpandu_at_miel.mot.com> wrote:
> Hi,
>
> This is regarding migration work from informix to Oracle.
>
> INFORMIX 7.X database columns of SERIAL datatype does increment
> automatically on an insert operation. For eg..
>
> I created a table called Employee. Below are fields created in that.
>
> Emp_id of type 'SERIAL'
> Emp_name of type 'CHAR'
>
> I am trying to do some insert operation on this table.
>
> INSERT INTO EMPLOYEE(Emp_name) VALUES ('JAMES')
> INSERT INTO EMPLOYEE(Emp_name) VALUES ('HARISH')
>
> If I select all from employee table, I see the following output as
> below.
>
> Emp_id Emp_name
> 1 JAMES
> 2 HARISH
>
> Here the Emp_id is automatically incremented.
>
> In ORACLE,
> ----------
>
> I created a table same as employee with following fields:
>
> Emp_id of type 'number'
> Emp_name of type 'varchar2'
>
> When I tried to do same insert operation, I get an error.
> Since in Oracle database column use NUMBER datatype and a sequence for
> this is created for equivalent to SERIAL in Informix. All the INSERT
> statements for such tables requires values for the ‘converted serial
> datatype’ columns in terms of the corresponding
> '<sequence_name>.nextval’.
>
> create sequence yy ;
> INSERT INTO EMPLOYEE(Emp_id, Emp_name) VALUES(yy.NEXT,'JAMES');
>
> Output I see in EMPLOYEE Table is:
>
> Emp_id Emp_name
> 1 JAMES
> 2 HARISH
>
> Will oracle support having auto incrementing field type. Since we
want
> our client to be database independent, I can't have two different
format
> of insert operation.
>
> Is there any solution, where in ORACLE support auto increment of the
> number...
>
> Pls. let know.
>
> Thanx in advance,
> Harish
> email: hpandu_at_miel.mot.com
>
>

You can play games with the options on create sequence, but you still have a fundamental problem that there are distinctions between the way Informix and Oracle do certain things. To keep things database independent, you have to write your own code to do these certain things. Go ahead and blame Oracle. Wait until you try to get the locking mechanisms to work the same! ;-)

jg
--
These opinions mine
mailto:joel-garry_at_nospam.home.com
Remove nospam to mail
http://ourworld.compuserve.com/homepages/joel_garry/oracleln.htm

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Thu Dec 09 1999 - 17:06:13 CST

Original text of this message

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