Page 1 of 1

Generating sequence numbers

Posted: Thu Aug 14, 2003 6:51 am
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.

Re: Generating sequence numbers

Posted: Thu Aug 14, 2003 8:51 am
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.

Posted: Thu Aug 14, 2003 10:26 am
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.