1321: IS
1322: SELECT c_onhand_qty
1323: FROM (select fact.item_org_id,
1324: sum(decode(cal.report_date, p_transaction_date, onhand_qty, null)) c_onhand_qty
1325: from opi_inv_val_sum_mv fact,
1326: fii_time_rpt_struct_v cal
1327: where fact.time_id = cal.time_id
1328: and fact.item_org_id = (p_inventory_item_id||'-'||p_organization_id)
1329: and fact.organization_id = p_organization_id