Surrogate Key

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
c341
Participant
Posts: 39
Joined: Mon Jan 26, 2004 8:43 pm

Surrogate Key

Post by c341 »

Hi
I'm using @OUTROWNUM variable to generate surrogate keys...and I entered my records in the Oracle table. When i try to insert a new record i've to find the max surrogate key generated and include this in the derivation with an increment.
How can I do this!
Thank You
sivatallapaneni
Participant
Posts: 53
Joined: Wed Nov 05, 2003 8:36 am

Post by sivatallapaneni »

In a before job get the max surrogate key and write it to a hash file and write a routine to get the value in the hash file and assign that to a stage variable and increment that stage variable using your @OUTROWNUM.

Hope this helps.
Siva
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You can certainly do this. There are many techniques, you can search for them on the Forum.
Then again, you may not need to. If the target database supports serial data type, or sequences, then you can have the surrogate keys generated when inserting rows into the dimension tables.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
phanee_k
Charter Member
Charter Member
Posts: 68
Joined: Thu Nov 20, 2003 11:02 pm

Post by phanee_k »

Hi
We can use the KeyMgtGetNexValConcurrent routine which is present in datastage for generating the sequence numbers using Datastage.Tyr this routine

Hope this Helps
Phani
nag0143
Premium Member
Premium Member
Posts: 159
Joined: Fri Nov 14, 2003 1:05 am

Post by nag0143 »

hi sivatallapaneni,
:?:
write a routine to get the value in the hash file and assign that to a stage variable
:?:

i din't understand it... can u show me a sample (ex..) routine which do that.

thank you


nag
sivatallapaneni
Participant
Posts: 53
Joined: Wed Nov 05, 2003 8:36 am

Post by sivatallapaneni »

Do a search and you will definetly find some thing to get going.

Here is a good one.

Code: Select all

http://dsxchange.com/viewtopic.php?t=86052&highlight=openpath
This should get you going.

Siva.
c341
Participant
Posts: 39
Joined: Mon Jan 26, 2004 8:43 pm

Post by c341 »

Hi
It worked....
Thank you All
Post Reply