The use of sequences

Started by Roy Sigurd Karlsbakkover 27 years ago3 messagesgeneral
Jump to latest
#1Roy Sigurd Karlsbakk
roy@christianianett.no

Could somebody tell me how I can make efficient use of sequences? I am
familiar with Oracle's sequences and they usually work as the following
example:
INSERT INTO PERSON table(some_sequence.nextval,data,data,data);

How do they work in postgreSQL?

Roy

--
Roy Sigurd Karlsbakk - MCSE, CNE, CLS, ASE - <roy@christianianett.no>
ChristianiaNett A/S, Akersgt. 11, 0158 OSLO, +47 2247 3100
http://www.christianianett.no/ (norwegian)

#2Herouth Maoz
herouth@oumail.openu.ac.il
In reply to: Roy Sigurd Karlsbakk (#1)
Re: [GENERAL] The use of sequences

At 17:40 +0300 on 18/8/98, Roy Sigurd Karlsbakk wrote:

Could somebody tell me how I can make efficient use of sequences? I am
familiar with Oracle's sequences and they usually work as the following
example:
INSERT INTO PERSON table(some_sequence.nextval,data,data,data);

How do they work in postgreSQL?

Look in the manpage of create_sequence

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma

#3Jeremiah Davis
jdavis@gaslightmedia.com
In reply to: Roy Sigurd Karlsbakk (#1)
Re: [GENERAL] The use of sequences

CREATE SEQUENCE some_sequence start 1 increment 1;

CREATE TABLE person (
id int4 default nextval('some_sequence'),
name varchar(200),
description text);

INSERT INTO person VALUES(nextval('some_sequence'),'Jeremiah','not much');

or

INSERT INTO person(name,description) VALUES('Jeremiah','not much');

On Tue, 18 Aug 1998, Roy Sigurd Karlsbakk wrote:

Show quoted text

Could somebody tell me how I can make efficient use of sequences? I am
familiar with Oracle's sequences and they usually work as the following
example:
INSERT INTO PERSON table(some_sequence.nextval,data,data,data);

How do they work in postgreSQL?

Roy

--
Roy Sigurd Karlsbakk - MCSE, CNE, CLS, ASE - <roy@christianianett.no>
ChristianiaNett A/S, Akersgt. 11, 0158 OSLO, +47 2247 3100
http://www.christianianett.no/ (norwegian)