|
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。如果您注册时有任何问题请联系客服QQ: 83569622 。
您需要 登录 才可以下载或查看,没有帐号?注册
x
一段代码,关于某供应商结算明细问题,代码长时间运行,就是没有结果。可能是执行计划有问题,哪位能帮忙修改修改?
代码如下:
select mmt.organization_id,
hou.name organization_name,
mmt.subinventory_code,
pv.segment1 vendor_num,
pv.vendor_name || '-' || ps.vendor_site_code owning_party,
pha.segment1 po_name,
msi.inventory_item_id,
msi.segment1 item_code,
msi.description item_description,
mmt.transaction_uom,
decode(substr(p.organization_code, 1, 1), 'A', '资本', '非资本') org_type,
mmt3.transaction_quantity,
mmt.transaction_cost
from mtl_material_transactions mmt,
mtl_material_transactions mmt2,
mtl_parameters p,
mtl_system_items_b msi,
hr_organization_units hou,
po_headers_all pha,
po_vendor_sites_all ps,
po_vendors pv,
(select a.transaction_quantity,
a.transaction_id,
qvmi_rep_pkg.get_transaction_id(a.transaction_id) tr_id
from mtl_material_transactions a, qinv_rcv_transaction_detail d
where a.transaction_type_id in (40, 41)
and a.organization_id = '&P_ORGANIZATION_ID'
and a.attribute15 = d.detail_id
and trunc(a.transaction_date) between
nvl(to_date('&P_TRAN_DATE_FROM',
'yyyy / mm / dd hh24 :mi :ss'),
trunc(a.transaction_date)) and
nvl(to_date('&P_TRAN_DATE_TO', 'yyyy / mm / dd hh24 :mi :ss'),
trunc(a.transaction_date))) mmt3
where mmt.inventory_item_id = msi.inventory_item_id
and mmt.transaction_id = mmt3.tr_id
and mmt.organization_id = msi.organization_id
and mmt.organization_id = hou.organization_id
and mmt.transaction_type_id = 74
and mmt.transaction_source_id = pha.po_header_id
and pha.org_id = ps.org_id
and pv.vendor_id = ps.vendor_id
and mmt.owning_tp_type = 1
and ps.vendor_site_id = mmt.owning_organization_id
and mmt2.transaction_batch_id = mmt.transaction_batch_id
and mmt2.attribute15 = mmt.attribute15
and mmt2.attribute14 = 'VMI ISSUE'
and mmt2.transaction_source_type_id in (3, 6, 13)
and mmt2.transfer_subinventory is null
and mmt2.organization_id = p.organization_id
and mmt.organization_id = '&P_ORGANIZATION_ID'
and pv.vendor_id = '76'
and ps.vendor_site_id = '75'
and pha.segment1 = 'SDCNC-WQ-0408-004'
其中:mtl_material_transactions 记录:2878840
mtl_parameters 记录:114
mtl_system_items_b 记录: 872468
hr_organization_units 记录:212
po_headers_all 记录:45783
po_vendor_sites_all 记录:11854
po_vendors 记录:7703
qinv_rcv_transaction_detail 记录:13995 |
|