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: ORACLE8: Automatic Counter Problem

Re: ORACLE8: Automatic Counter Problem

From: <markp7832_at_my-dejanews.com>
Date: Wed, 14 Apr 1999 19:29:48 GMT
Message-ID: <7f2qav$pii$1@nnrp1.dejanews.com>


In article <Pine.GSO.4.10.9904141659210.24128-100000_at_ogre.rby.hk-r.se>,   Magnus Lindhe <pt96mli_at_student.hk-r.se> wrote:
> Is it possible to have some kind of automatic counter data type in Oracle
> 8? If not, how can the same behaviour be solved by the developer?
>
> /magnus
>

It sounds like you are asking about a sequence generator which is used to create a numeric sequence of values that are often used as a key. See the CREATE SEQUENCE command in the SQL Manual and you can look up using sequences in the Concepts manual and/or the DBA Admin. Guide.

Basically you can:
create sequence sequence_name;

insert into my_table (key, other_col)
values ( sequence_name.nextval,'other_col_value');

--
Mark D. Powell -- The only advice that counts is the advice that  you follow so follow your own advice --

-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Wed Apr 14 1999 - 14:29:48 CDT

Original text of this message

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