Discussion Locked

Number in Sequence Order

0 helpful
7 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have a application (VB - Oracle) used by 50+ users. Now for 1 module I have to generate Number in Sequence Order with the date saved and the no is displayed after the data is saved.

The number should not be duplicate in any of the rows.

I donot want to loss any no. from the sequence. How do I implement this code.

(e.g. LPO No., HelpDesk CASE ID etc....)

Thanks in advance.

7 replies

by jay eckles

One possible approach that PeopleSoft takes is to have a separate "installation" table. It basically holds the data for the next available number in a collection of sequences. You could have an extra table hold the next available number in your sequence. You could also do a select to make sure the number you're about to use isn't already in the target table.

Does Oracle not have an auto-incrementing index column ala Access?

Good luck.

Jay Eckles
www.jayeckles.com

by alphacentauri

create sequence myseq start with 1 increment by 1
insert into mytab(mydate, mynum) values (sysdate, myseq.nextval)

if you need the seq, you can capture it outside the sql using: select myseq.nextval from dual
and then use that number in the insert statement
hope this helps

This discussion is closed to new replies.