Unable to execute Before SQL statement

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
kiran kumar
Participant
Posts: 25
Joined: Wed May 02, 2007 1:07 am

Unable to execute Before SQL statement

Post by kiran kumar »

Hi,

I tried to execute a Before SQL statement in one of my DS Job (v8.5). during execution it is throwing the error.

"OC_TD_MeterGroup_STG: The OCI function executeDirect returned status -1. Error code: 24,374, Error message: ORA-24374: define not done before fetch or execute and fetch. (CC_OraUtils::handleBeforeAfterSQL, file CC_OraUtils.cpp, line 4,633)"

I tried to search the forum, but no joy.

Can you please help me with this.

Thank You!
SURA
Premium Member
Premium Member
Posts: 1229
Joined: Sat Jul 14, 2007 5:16 am
Location: Sydney

Re: Unable to execute Before SQL statement

Post by SURA »

Because it s an oracle error might be the reason. Are you trying to execute procedure / sql query?

DS User
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am
Location: USA

Post by qt_ky »

What statement is in the Before SQL?
Choose a job you love, and you will never have to work a day in your life. - Confucius
kiran kumar
Participant
Posts: 25
Joined: Wed May 02, 2007 1:07 am

Post by kiran kumar »

Its a general SQL query.

SELECT BATCH_NUMBER FROM CON.BT_GROUP
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You can't do things like "SELECT" before sql, where would the results go? You need to do "before things" like alter the session or truncate a table, to name a couple of options off the top of my head.

Forget the before SQL error and tell us what you are trying to accomplish instead, why you need this batch number, how it will be used in / by the job.
-craig

"You can never have too many knives" -- Logan Nine Fingers
kiran kumar
Participant
Posts: 25
Joined: Wed May 02, 2007 1:07 am

Post by kiran kumar »

Thank you, Craig.

I'm trying to extract the max(Batch_Number) from a table. So, that I can use this value and increment by 1 every time i run the job.

I tried using a routine (using basic transformer) that did not work.
used, jobruntime as well...no Joy.

Can you please share any thoughts on this.


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

Unable to execute Before SQL statement

Post by austin_316 »

Can you please specify the exact meaning of

Code: Select all

I tried using a routine (using basic transformer) that did not work. 
used, jobruntime as well...no Joy.
What actually did not work?
This can be done using before job sub routine. You can fetch the value and pass it as a paramter to the job. :)
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am
Location: USA

Post by qt_ky »

Try moving that select statement into the select statement for the stage (not a generated SQL statement), or moving it into a select statement in a separate Oracle stage.
Choose a job you love, and you will never have to work a day in your life. - Confucius
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Re: Unable to execute Before SQL statement

Post by chulett »

austin_316 wrote:This can be done using before job sub routine. You can fetch the value and pass it as a paramter to the job. :)
No, it can't. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
jwiles
Premium Member
Premium Member
Posts: 1274
Joined: Sun Nov 14, 2004 8:50 pm
Contact:

Post by jwiles »

You could use a Job Sequence Execute Command Activity to call a shell script which runs the query against the database, retrieve the value and pass it as a parameter to your job.

Regards,
- james wiles


All generalizations are false, including this one - Mark Twain.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Yup, it really depends on what you need to do with this batch number other than simply increment it.
-craig

"You can never have too many knives" -- Logan Nine Fingers
kiran kumar
Participant
Posts: 25
Joined: Wed May 02, 2007 1:07 am

Post by kiran kumar »

I am trying to capture the records which gets rejected for every job/batch run.
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am
Location: USA

Post by qt_ky »

That sounds like a new topic to me. Did you try any of the above suggestions for this topic?
Choose a job you love, and you will never have to work a day in your life. - Confucius
Post Reply