How to only write to Seq. File if SELECT return something ?

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
faujong
Participant
Posts: 11
Joined: Fri Aug 17, 2018 9:03 am

How to only write to Seq. File if SELECT return something ?

Post by faujong »

I have an Oracle Connector stage that SELECT from Oracle database, and write the result to a Sequential File.
How can I only write to the Sequential File if the SELECT statement returns something (if SELECT statement doesn't return anything, don't write to the Sequential File) ?
Thank you.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Technically it won't write anything to the file so assuming you mean don't create the file... and that's not an option. You either need to delete it post-job if it is "empty", that or put a pre-check in place and only run the job when there is actually data to write to the file.
-craig

"You can never have too many knives" -- Logan Nine Fingers
faujong
Participant
Posts: 11
Joined: Fri Aug 17, 2018 9:03 am

Post by faujong »

Thank you for your reply. Yes, I meant not to create the file if SELECT returns nothing.
I will see if I can delete the file post-job, if the file only has 1 row (the column headers).

Thank you.
Post Reply