Skip site navigation (1) Skip section navigation (2)

Re: Creating sequences

From: "Adam Lang" <aalang(at)rutgersinsurance(dot)com>
To: "Gannon, Terry" <Terry(dot)Gannon(at)trican(dot)ca>, <pgsql-sql(at)postgresql(dot)org>
Cc: "David Lloyd-Jones" <icomm5(at)attcanada(dot)ca>
Subject: Re: Creating sequences
Date: 2000-08-21 19:12:47
Message-ID: 01e201c00ba3$cb9e5520$330a0a0a@Adam (view raw, whole thread or download thread mbox)
Lists: pgsql-sql
This is what I wanted to do.  When I can have a primary key that is
meaningful AND won't change, I would like to try to use it, otherwise I'd
probably use an OID.  So... I'm developing a database that will have the
primary key like a "case number" (like when you call for tech support).  Say
your call center has 3 products: Word processor, Spread Sheet, Database.
When you open a case for a product, that product's code will be the
beginning of the case number.  Say, Word processor will be WP00001,
Spreadsheet will be SS00001, etc. (Each product would be in its own table).

Each time a case is opened, it would increment to the next number.

Granted, I could probably just code something where I set up a sequence and
when I do an insert, it concatenates the prefix to the number and then
inserts the value, but I was curious if there was a way where you can set
the initial value to alphanumeric and it will increment from there.

Adam Lang
Systems Engineer
Rutgers Casualty Insurance Company
----- Original Message -----
From: "Gannon, Terry" <Terry(dot)Gannon(at)trican(dot)ca>
To: "'Adam Lang'" <aalang(at)rutgersinsurance(dot)com>
Sent: Friday, August 18, 2000 4:15 PM
Subject: RE: [SQL] Creating sequences

> Adam -- suggest that a way to do this would be to use a stored procedure
> that would read the sequence number associated with the table, and build
> variable as you require.  You would then setup a trigger that would launch
> the stored procedure everytime you insert a new record into the table?  If
> that's a little foggy, then I would suggest that if you can part with the
> definition of the table that I could put together a little example to
> illustrate...regards...
> Terry Gannon
> tgannon(at)stoneboat(dot)com
> > -----Original Message-----
> > From: Adam Lang [SMTP:aalang(at)rutgersinsurance(dot)com]
> > Sent: Friday, August 18, 2000 12:25 PM
> > To: pgsql-sql(at)postgresql(dot)org
> > Subject: [SQL] Creating sequences
> >
> > Is it possible to have a sequence (or something like it) when it
> > increments
> > alpha-numeric?
> >
> > Say the first value is set at A01 and it will increment to A02, A03 by
> > default.  Also, it would be good if it could be made the primary key.
> >
> > Adam Lang
> > Systems Engineer
> > Rutgers Casualty Insurance Company

pgsql-sql by date

Next:From: Ingram, BryanDate: 2000-08-21 19:21:00
Subject: Re: Best way to create DML/DDL log?
Previous:From: Franz J FortunyDate: 2000-08-21 17:53:02
Subject: Speed or configuration

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group