Logic for DB2 sequence develop in Data stage

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
n.parameswara.reddy@accen
Participant
Posts: 40
Joined: Mon May 18, 2009 5:22 am

Logic for DB2 sequence develop in Data stage

Post by n.parameswara.reddy@accen »

CREATE SEQUENCE STEVE.SEQ_KEY_ACCTS
AS INTEGER
START WITH 1
INCREMENT BY 1;

CREATE TABLE STEVE.TESTSEQ LIKE NEG085_20090210.ACCOUNT;

INSERT INTO STEVE.TESTSEQ
SELECT * FROM NEG085_20090210.ACCOUNT ORDER BY SRC_SYS_ACCT_KEY FETCH FIRST 10 ROWS ONLY;

ALTER table STEVE.TESTSEQ ADD COLUMN NEW_SRC_SYS_ACCT_KEY INTEGER;

UPDATE STEVE.TESTSEQ SET NEW_SRC_SYS_ACCT_KEY = nextval for STEVE.SEQ_KEY_ACCTS;


Can any one help us regarding above logic for DB2 sequence develop in Datastage


Advance thanks for your help
Thanks
PARAM
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The DDL pieces can be done in Before-SQL.
The DataStage job should select the first 10 rows and pass these through to an INSERT statement.
Create the key column up front and include the reference to the sequence within user-defined SQL.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply