Page 1 of 1

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

Posted: Wed Sep 19, 2018 10:50 am
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.

Posted: Wed Sep 19, 2018 2:54 pm
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.

Posted: Thu Sep 20, 2018 6:20 am
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.