Oracle EBS-SQL (INV-1):检查物料成本为0并且物料状态不是'NEW'的物料.sql

时间:2023-12-20 09:46:08

select --msi.inventory_item_id
        --,msi.organization_id
     msi.segment1                                        物料编码
    ,msi.Description                                    物料描述
    ,msi.INVENTORY_ITEM_STATUS_CODE           状态
    ,decode(cic.ITEM_COST,'',0,cic.ITEM_COST) 成本
    ,cic.COST_TYPE_ID                               成本类型
    ,msi.creation_date                               创建日期
from   inv.mtl_system_items_b msi,
          bom.cst_item_costs cic

where   msi.organization_id=X
   and msi.INVENTORY_ITEM_STATUS_CODE<>'New'
   and msi.INVENTORY_ITEM_ID=cic.INVENTORY_ITEM_ID
   and cic.organization_id=msi.organization_id
   and cic.COST_TYPE_ID in (1)
   and decode(cic.ITEM_COST,'',0,cic.ITEM_COST)=0
    and msi.INVENTORY_ITEM_STATUS_CODE not in ('Inactive','PHActive')
    order by msi.creation_date