During second run, source table will have data as belowTarget Table
SOURCE_DATE---ENDDATE----RUN_ID---FROM_DATE----TO_DATE
01-JAN-2013----31-DEC-9999---1-------01-JAN-2013---01-JAN-2013
01-JAN-2013----31-DEC-9999---1-------01-JAN-2013---07-JAN-2013
01-JAN-2013----31-DEC-9999---1-------08-JAN-2013---31-JAN-2013
Source table data need to be inserted to target table. Before inserting the data in END_DATE column of the target table need to be updated with 01-FEB-2013 instead 31-JAN-9999. .Source Table
SOURCE_DATE---ENDDATE----RUN_ID---FROM_DATE----TO_DATE
01-FEB-2013----31-DEC-9999---2-------01-FEB-2013---01-FEB-2013
01-FEB-2013----31-DEC-9999---2-------01-FEB-2013---07-FEB-2013
01-FEB-2013----31-DEC-9999---2-------08-FEB-2013---31-FEB-2013
I am using DB2 connector, and I achieved above said using SQL "Before SQL" section in DB2 connector.
Data in the target table is as follows
My issue is "Before SQL" is executed even if source table has no rows when job runs. How can I restrict "Before SQL" not to be executed if there are no input rows to be inserted to the target table?Target Table
SOURCE_DATE---ENDDATE----RUN_ID---FROM_DATE----TO_DATE
01-JAN-2013----31-FEB-2013---1-------01-JAN-2013---01-JAN-2013
01-JAN-2013----31-FEB-2013---1-------01-JAN-2013---07-JAN-2013
01-JAN-2013----31-FEB-2013---1-------08-JAN-2013---31-JAN-2013
01-FEB-2013----31-DEC-9999---2-------01-FEB-2013---01-FEB-2013
01-FEB-2013----31-DEC-9999---2-------01-FEB-2013---07-FEB-2013
01-FEB-2013----31-DEC-9999---2-------08-FEB-2013---31-FEB-2013
i.e END_DATE of rows inserted during 2nd run is getting updated with 3rd RUN DATE without any rows being inserted from 3rd run.
That fails my requirement.