Oracle sequence

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
mmanes
Participant
Posts: 91
Joined: Tue Mar 16, 2004 10:20 am
Location: Rome

Oracle sequence

Post by mmanes »

Hi,
how can I insert a oracle sequence with DataStage 8.1?

tks for help
Poovalingam
Participant
Posts: 111
Joined: Mon Nov 30, 2009 7:21 am
Location: Bangalore

Re: Oracle sequence

Post by Poovalingam »

We can invoke oracle sequence within transformer stage or we can call SequenceName.nextval in insert sql.
mmanes
Participant
Posts: 91
Joined: Tue Mar 16, 2004 10:20 am
Location: Rome

Post by mmanes »

How we can do it within transformer?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You can use an Oracle sequence in user-defined SQL, for example

Code: Select all

 INSERT INTO myschema.mytable(C1,C2,C3) VALUES mysequence.NEXTVAL, ORCHESTRATE.C2, ORCHESTRATE.C3);
I leave it to Poovalingam to explain how to invoke within a Transformer stage; it's not something I'd do directly.

Instead, I would connect a Surrogate Key Generator stage to the Oracle sequence, and use the appropriate function to get the next surrogate key within the Transformer stage.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
mmanes
Participant
Posts: 91
Joined: Tue Mar 16, 2004 10:20 am
Location: Rome

Post by mmanes »

Ok, but I have to insert the value in the field into transformer stage.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

I did address that in my response. You need to get yourself a premium membership to be able to view the entire response from the five premium posters. (This is the mechanism by which DSXchange is funded.)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
mmanes
Participant
Posts: 91
Joined: Tue Mar 16, 2004 10:20 am
Location: Rome

Post by mmanes »

OK I'm sorry.
I cannot spend $99.
Thank you anyway.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

mmanes wrote:Ok, but I have to insert the value in the field into transformer stage.
Why do you "have to" do it in a transformer?
-craig

"You can never have too many knives" -- Logan Nine Fingers
mmanes
Participant
Posts: 91
Joined: Tue Mar 16, 2004 10:20 am
Location: Rome

Post by mmanes »

Because I no need to write code and it is easy for maintenance.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

So not a "need" after all but rather a preference. Fair enough.
-craig

"You can never have too many knives" -- Logan Nine Fingers
mmanes
Participant
Posts: 91
Joined: Tue Mar 16, 2004 10:20 am
Location: Rome

Post by mmanes »

anyway... now I "need" to find another way.
Thank you.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Why not take the user-defined SQL route using NEXTVAL? That or a Sequence Generator?
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

mmanes wrote:I cannot spend $99.
Less than 30c per day. How much do you spend on coffee?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
spoilt
Participant
Posts: 7
Joined: Mon Mar 25, 2013 7:17 am

Post by spoilt »

Use transformer Stage Property.

Surrogate tab.
SourceType = DbSequence.
Database = oracle
user / password / server.
Source name = your sequence name


=> Derivation: NextSurrogateKey()
mmanes
Participant
Posts: 91
Joined: Tue Mar 16, 2004 10:20 am
Location: Rome

Post by mmanes »

Ray,
my work situation is critical but no matter, I'll find a way to make a clean development without workaround.

Thank you anyway.
Post Reply