OPM Lot Costs

Description
Columns: Batch No, Batch Id, Txntype, Transaction Id, Batch Status, Transaction Source Id, Line Type, Material Detail Id, Organization Id, Inventory Item Id ...
SELECT h.batch_no,
       d.batch_id,
       mtt.transaction_type_name TxnType,
       t.transaction_id,
       h.batch_status,
       t.transaction_source_id,
       d.line_type,
       t.trx_source_line_id AS material_detail_id,
       t.organization_id,
       t.inventory_item_id,
       t.subinventory_code,
       t.locator_id,
       lt.lot_number,
       t.primary_quantity,
       t.transaction_quantity,
       lt.transaction_quantity AS lot_qty,
       t.transaction_uom,
       t.secondary_transaction_quantity AS sec_qty,
       t.secondary_uom_code,
       TO_CHAR(t.transaction_date, 'DD-MON-YYYY HH24:MI:SS') AS trans_date,
       TO_CHAR(lot.origination_date, 'DD-MON-YYYY HH24:MI:SS') AS origination_date,
       TO_CHAR(lot.creation_date, 'DD-MON-YYYY HH24:MI:SS') AS creation_date,
       TO_CHAR(h.actual_start_date, 'DD-MON-YYYY HH24:MI:SS') AS start_date,
       TO_CHAR(h.actual_cmplt_date, 'DD-MON-YYYY HH24:MI:SS') AS cmplt_date
  FROM mtl_material_transactions   t,
       gme_material_details        d,
       gme_batch_header            h,
       mtl_transaction_lot_numbers lt,
       mtl_lot_numbers             lot,
       mtl_transaction_types       mtt
 WHERE t.transaction_source_type_id = 5
   AND t.transaction_source_id = h.batch_id
   AND t.organization_id = h.organization_id
   AND d.batch_id = h.batch_id
   AND d.material_detail_id = t.trx_source_line_id
   AND mtt.transaction_type_id = t.transaction_type_id
   AND mtt.transaction_action_id = t.transaction_action_id
   AND mtt.transaction_source_type_id = t.transaction_source_type_id
   AND d.line_type = -1
   AND t.transaction_action_id = 1
   AND t.transaction_type_id = 35
   AND lt.transaction_id(+) = t.transaction_id
   AND lot.lot_number = lt.lot_number
   AND lot.organization_id(+) = lt.organization_id
   AND lot.inventory_item_id(+) = lt.inventory_item_id
   --AND t.transaction_date < lot.origination_date