Relation between usage covered line and counters and readings
select mtl_ln_itm.segment1,csi.serial_number from
okc_k_headers_b okh,
okc_k_lines_b ln,
okc_k_items ln_item,
mtl_system_items mtl_ln_itm,
okc_k_lines_b cln,
okc_k_items oki,
cS_COUNTERS cs,
CS_COUNTER_VALUES csv,
CS_COUNTER_GROUPS csg,
csi_item_instances csi
where okh.contract_number='XX-OKS-001'
and okh.id= ln.chr_id
and ln.lse_id=12
and cln.cle_id= ln.id
and oki.cle_id=cln.id
and cs.counter_id=to_number(oki.OBJECT1_ID1)
and csv.COUNTER_ID= cs.counter_id
and ln_item.CLE_ID = ln.id
and mtl_ln_itm.inventory_item_id= to_number(ln_item.OBJECT1_ID1)
and mtl_ln_itm.organization_id= to_number(ln_item.OBJECT1_ID2)
and mtl_ln_itm.segment1='&usage_item'
and csg.COUNTER_GROUP_ID=cs.COUNTER_GROUP_ID
and csi.instance_id =csg.source_object_id
and csi.serial_number ='&serail number'
select mtl_ln_itm.segment1,csi.serial_number from
okc_k_headers_b okh,
okc_k_lines_b ln,
okc_k_items ln_item,
mtl_system_items mtl_ln_itm,
okc_k_lines_b cln,
okc_k_items oki,
cS_COUNTERS cs,
CS_COUNTER_VALUES csv,
CS_COUNTER_GROUPS csg,
csi_item_instances csi
where okh.contract_number='XX-OKS-001'
and okh.id= ln.chr_id
and ln.lse_id=12
and cln.cle_id= ln.id
and oki.cle_id=cln.id
and cs.counter_id=to_number(oki.OBJECT1_ID1)
and csv.COUNTER_ID= cs.counter_id
and ln_item.CLE_ID = ln.id
and mtl_ln_itm.inventory_item_id= to_number(ln_item.OBJECT1_ID1)
and mtl_ln_itm.organization_id= to_number(ln_item.OBJECT1_ID2)
and mtl_ln_itm.segment1='&usage_item'
and csg.COUNTER_GROUP_ID=cs.COUNTER_GROUP_ID
and csi.instance_id =csg.source_object_id
and csi.serial_number ='&serail number'
No comments:
Post a Comment