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 -> Clarification of 'Sequences'

Clarification of 'Sequences'

From: steve hendrikse <shend_at_sar-net.com>
Date: 1998/09/30
Message-ID: <6ute2i$2a7$1@zeke.ebtech.net>#1/1

Good Day,

I have reasonable experience with both PostgreSQL and Micrsoft SQLServer. WIth both I can create a column in a table that automatically generates a unique count value. That is:

in MSSQL, i do:

        create tabel test1(
                    id        int identity(1,1) not null,
                    value    varchar(80)
         );

in PostgreSQL, it is slightly more complex, but similar to:

        create sequence seq_id start 1 increment 1;
        create table test2(
                    id         int4 default nextval('seq_id') not null,
                    value     varchar(80)

);

now, in Oracle 8.0.4 (on Solaris), i believe that i must do something similar to the PostgreSQL case. I start with:

        create sequence seq_id start with 1 increment by 1;

and then (?????)

        create table

                    id        int default seq_id.nextval not null,
                    value    varchar(80)

);

but this gets me an error saying that i cannot include a column name (seq_id) in the table definition.

now, i conclude that if both MSSQL and PostgreSQL can do this (as shown above) there has to be a 'graceful' way to get Oracle to do it also.

please help!!!

thanks in advance,
steve Received on Wed Sep 30 1998 - 00:00:00 CDT

Original text of this message

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