Oracle EBS-SQL (WIP-2):检查非标任务没挂自己本身.sql
SELECT WE.WIP_ENTITY_NAME,
MSI.SEGMENT1,
MSI.DESCRIPTION,
WDJ.CLASS_CODE,
WDJ.START_QUANTITY,
WDJ.SCHEDULED_START_DATE
FROM wip.WIP_ENTITIES WE,
wip.WIP_DISCRETE_JOBS WDJ,
INV.MTL_SYSTEM_ITEMS_B MSI
WHERE WE.WIP_ENTITY_ID = WDJ.WIP_ENTITY_ID
AND MSI.INVENTORY_ITEM_ID = WDJ.PRIMARY_ITEM_ID
AND MSI.ORGANIZATION_ID = WDJ.ORGANIZATION_ID
AND WDJ.ORGANIZATION_ID = X
AND WDJ.JOB_TYPE = 3
AND WDJ.STATUS_TYPE IN (1, 3)
AND NOT EXISTS (SELECT 'X'
FROM WIP.WIP_REQUIREMENT_OPERATIONS WRO
WHERE WRO.WIP_ENTITY_ID = WDJ.WIP_ENTITY_ID
AND wro.inventory_item_id = wdj.PRIMARY_ITEM_ID)