Thursday, August 23, 2012

Date Difference in Hours


Scenario: There is A ORDER_DELIVERY table having record like this

   ORDER_NO         ORDER_DATE          DELIVERY_DATE
   ---------                        ---------                 --------
        2                         11-JAN-83             13-JAN-83
        3                         04-FEB-83             07-FEB-83
        1                         08-DEC-81            09-DEC-81

We have to calculate difference between ORDER_DATE and delivery date in hours and send it to target.
o/p will be

 ORDER_NO   ORDER_DATE     DELIVERY_ DATE        DIFF_IN_HH
 ---------                     ---------                  ---------                ---------
     2                       11-JAN-83            13-JAN-83               48
     3                       04-FEB-83            07-FEB-83                72
     1                       08-DEC-81           09-DEC-81                24

These are the steps for achieving this scenario

Connect one expression transformation next to SQ Transformation.

 In expression create one out/put port “diff” and make it integer type.


 In that port write the condition like this and sent to target.

1 comment:

Thank you :
- kareem