Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

suggestion: sequences

2 posts in Product Futures Discussion Last posting was on 2005-09-13 08:14:41.0Z
krisztian pinter Posted on 2005-09-09 15:04:03.0Z
Subject: suggestion: sequences
Newsgroups: sybase.public.ase.product_futures_discussion
From: "krisztian pinter" <pinterkr@freemail.hu>
Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-2
MIME-Version: 1.0
Content-Transfer-Encoding: Quoted-Printable
Message-ID: <opswub69f6wwfehv@kar_wst_pint>
User-Agent: Opera M2/7.54 (Win32, build 3869)
X-Original-NNTP-Posting-Host: b178.dummy.pool.eol.hu
X-Original-Trace: 9 Sep 2005 08:04:00 -0700, b178.dummy.pool.eol.hu
Lines: 37
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 9 Sep 2005 08:04:01 -0700, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 9 Sep 2005 08:04:03 -0700
X-Trace: forums-1-dub 1126278243 10.22.108.75 (9 Sep 2005 08:04:03 -0700)
X-Original-Trace: 9 Sep 2005 08:04:03 -0700, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.product_futures_discussion:1747
Article PK: 96694

ASA covers autoincrement fields quite well. However, in some situations,
it would be better to handle the ID generation separately from the data
inserts. Here is the proposal:

We need a dedicated sequence generator structure. For those, who are
familiar with oracle sequences, i have the same feature in mind.

A sequence would be created with CREATE SEQUENCE statement. It contains
a start and an optional end value, plus an optional step. You can use
the sequence in expressions (e.g. select MySequence.Next). It would also
smart to include global autoincrement features to it. ID generation
is out of the scope of transactions, so they can not be rolled back
(same as autoincrement fields).

Benefits:

In many applications, it is necessary to build complete in-memory
master-detail structures with more records, then save it in one go.
That is because you can implement a Cancel button that way. Now we
need to link the records via some internal method, and on creation,
insert each row, then read back the ID values, apply the references,
and go to the next row. This is a burden. With sequences, you would
be able to pre-generate the IDs as rows created in memory. It of
course leads to waste IDs on cancel, but it can be acceptable.

The method supports every feature of the old technique, as you
simply can write

INSERT INTO MYTABLE VALUES (MySeq.Next, ...)

or even, it is possible to define fields to get default values from
a sequence

MyField INT DEFAULT FROM SEQUENCE MySeq


krisztian pinter Posted on 2005-09-13 08:14:41.0Z
Newsgroups: sybase.public.ase.product_futures_discussion
Subject: Re: suggestion: sequences
References: <opswub69f6wwfehv@kar_wst_pint>
Message-ID: <opsw07vwxqwwfehv@kar_wst_pint>
From: "krisztian pinter" <pinterkr@freemail.hu>
Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-2
MIME-Version: 1.0
Content-Transfer-Encoding: Quoted-Printable
User-Agent: Opera M2/7.54 (Win32, build 3869)
NNTP-Posting-Host: b178.dummy.pool.eol.hu
X-Original-NNTP-Posting-Host: b178.dummy.pool.eol.hu
Date: 13 Sep 2005 01:14:41 -0700
X-Trace: forums-1-dub 1126599281 81.0.127.178 (13 Sep 2005 01:14:41 -0700)
X-Original-Trace: 13 Sep 2005 01:14:41 -0700, b178.dummy.pool.eol.hu
Lines: 12
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.product_futures_discussion:1748
Article PK: 96695

On 9 Sep 2005 08:04:03 -0700, krisztian pinter <pinterkr@freemail.hu>

wrote:

> ASA covers autoincrement fields quite well. However, in some situations,

Gosh! This was supposed to send to ASA ng. I don't know if it fits here
too.