Pbm using CURRVAL in datastage

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
austin_316
Participant
Posts: 80
Joined: Fri Aug 21, 2009 7:49 am
Location: India

Pbm using CURRVAL in datastage

Post by austin_316 »

We are trying to insert current value of DB sequence into a table in Oracle stage. But while executing the job its throwing an error as unable to insert the record. Where as nextval is working.

My query is:
INSERT INTO RUN_DETAIL (BATCH_RUN_ID) VALUES (run_seq.currval)
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Create a job that SELECTs the current value then passes this to the Oracle table using a regular INSERT (one with a VALUES clause containing a parameter marker).

DataStage wants to pass a value for at least one column for an INSERT.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Post the full error.
-craig

"You can never have too many knives" -- Logan Nine Fingers
austin_316
Participant
Posts: 80
Joined: Fri Aug 21, 2009 7:49 am
Location: India

Pbm using CURRVAL in datastage

Post by austin_316 »

when iam trying to insert a record into the table fetching the value from oracle sequence jus as in the query mentioned it is throwing me the error
"run_seq.CURRVALUE is not yet defined in the session"

my jobs looks something like this

oraclestage1->copystage->oraclestage2
|
v
sequential file

in oracle stage 1 iam reading the value from the sequence using run_seq.NEXTVAL and inserting that value in both my sequntialfile and oraclestage2.
i am getting the correct value from oraclestage1 but when iam trying to insert the value into my oraclestage2 it is throwing me the above error.
can anyone please suggest me solution for this?

TIA
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Ray already did. The stage wants at least one column defined and yet you need to leave the ID field out of the stage since it won't be bound to anything.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Try nextval instead of currval.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

They're already doing the NEXTVAL part upstream... hopefully there's a good reason for that, parent / child load or some such. Still won't fix the fundamental binding problem, however.
-craig

"You can never have too many knives" -- Logan Nine Fingers
austin_316
Participant
Posts: 80
Joined: Fri Aug 21, 2009 7:49 am
Location: India

Post by austin_316 »

we are already generating the sequence value in oraclestage1 and has to use the same and send it to both file and oraclestage2. so i cannot use nextval in my oraclestage2.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The error message is complaining about CURRVALUE (not CURRVAL) - maybe you've mistyped something somewhere?
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