Generating sequence numbers

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
fred
Participant
Posts: 3
Joined: Tue Aug 12, 2003 11:19 am

Generating sequence numbers

Post by fred »

Can someone please suggest a way to generate unique sequence numbers within Ascential. The purpose is to assign that number to a column in a table each time a new record is created using datastage.

Currently I am using Oracle sequences (and having a trigger on insert on the table to populate the column) , but was wondering if there is some other way to do it.

Thanks in advance.

Fred.
Teej
Participant
Posts: 677
Joined: Fri Aug 08, 2003 9:26 am
Location: USA

Re: Generating sequence numbers

Post by Teej »

fred wrote:Can someone please suggest a way to generate unique sequence numbers within Ascential. The purpose is to assign that number to a column in a table each time a new record is created using datastage.

Currently I am using Oracle sequences (and having a trigger on insert on the table to populate the column) , but was wondering if there is some other way to do it.

Thanks in advance.

Fred.
Forget Triggers. Use [columnname].NEXTVAL. For example:

INSERT INTO [Table] ([field]) VALUES ([field].NEXTVAL)

Of course, you will need to ensure that the column is a sequence column. (We use SQL Navigator, and it's part of the Sequences subcategory).

This is true for DataStage 6.0r3 Server Job using Ora9i stage, the results may varies for Parallel Job (I never tried it that way, I just use a custom stage.)

-T.J.
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Fred, search this archive, as well as tools4datastage.com archives, and Oliver listing archives on that same site. This topic has been covered extensively.
Post Reply