One more sql sentence should be exec

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
loucas
Participant
Posts: 13
Joined: Wed Oct 25, 2006 9:29 am

One more sql sentence should be exec

Post by loucas »

I have developed one job, and now I should exec one more user define sql sentence after the job. The sentense is not row based and it's bulk update and insert. The How can I do it? Which stage can I use?

Thanks for your attention!
Loucas
Hemant_Kulkarni
Premium Member
Premium Member
Posts: 50
Joined: Tue Jan 02, 2007 1:40 am

Post by Hemant_Kulkarni »

you can call multiple sql statements in "After" part of the Target

or you can write a stored procedure for the same and use the stored procedure in datastage jobs.
loucas
Participant
Posts: 13
Joined: Wed Oct 25, 2006 9:29 am

Post by loucas »

Thanks for your reply, Hemant_Kulkarni!
Hemant_Kulkarni wrote:you can call multiple sql statements in "After" part of the Target.

your meaning is that I should write some post logic Routine?
Hemant_Kulkarni wrote:or you can write a stored procedure for the same and use the stored procedure in datastage jobs.
If I add an stage which exec stored procedure, the stage need input column. And there are two mang rows, so how can I guarantee the stored procedure only exec one time?

Now in production env, I do like below.
I create a new job, includig one flat file stage and one odbc stage. the file stage read one file with only one row, and the odbc using user defined sql query. Then I add the job to the jobseq. If the previous job is finished ok, it will run.

Although the method is can do, but I think it's not a good method. It need one more permanent file.
Loucas
loucas
Participant
Posts: 13
Joined: Wed Oct 25, 2006 9:29 am

Post by loucas »

Any advice?
Loucas
surendra_ds
Participant
Posts: 12
Joined: Wed Apr 19, 2006 7:41 am

Hi

Post by surendra_ds »

U can use 'After SQL' in the target stage..That is enough for this situation
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Your method is perfectly fine, just needs a little tweak. I wouldn't use 'After' anything for this, what would you do if only the after part failed? Rerun everything? :?

Take your Sequential to ODBC job and remove the Sequential stage. Add a stage variable, it is required to satisfy the compiler but you don't need to use it. Biggest thing to not forget is a constraint or the job will generate rows forever. For you "@OUTROWNUM=1" will work and deliver a single row to the ODBC stage. Hard-code the values it needs in the transformer, or use Job Parameters there if they are a run time variable.
-craig

"You can never have too many knives" -- Logan Nine Fingers
loucas
Participant
Posts: 13
Joined: Wed Oct 25, 2006 9:29 am

Post by loucas »

Long time no logon, Thanks for your advice!
chulett wrote:Your method is perfectly fine, just needs a little tweak. I wouldn't use 'After' anything for this, what would you do if only the after part failed? Rerun everything? :?

Take your Sequential to ODBC job and remove the Sequential stage. Add a stage variable, it is required to satisfy the compiler but you don't need to use it. Biggest thing to not forget is a constraint or the job will generate rows forever. For you "@OUTROWNUM=1" will work and deliver a single row to the ODBC stage. Hard-code the values it needs in the transformer, or use Job Parameters there if they are a run time variable.
Loucas
Post Reply