查某個Item有無在BOM結構中

select msi.segment1 "Item",msi.description "Description" ,decode(count(1) ,0,'N','Y')
from BOM_BILL_OF_MATERIALS bom,
          BOM_INVENTORY_COMPONENTS bic,
          mtl_system_items_b msi
where bom.ASSEMBLY_ITEM_ID = msi.inventory_item_id
  and msi.organization_id=85
  and msi.segment1= 'T01-035'
  and bom.ALTERNATE_BOM_DESIGNATOR is null
  and bom.BILL_SEQUENCE_ID = bic.BILL_SEQUENCE_ID
  and bom.ORGANIZATION_ID = 85
  and bic.DISABLE_DATE is null
  and bic.IMPLEMENTATION_DATE is not null
group by msi.segment1,msi.description;