网站大量收购独家精品文档,联系QQ:2885784924

BOM树型查询含查找上级及顶级产品.doc

  1. 1、本文档共2页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
--新建一个表,将结果插入到表里面? create table CUX_BOM_ID (KINDID number(20),kindname varchar(200),FATHERID number(20),ITEMD number(20)) --新建一个存储过程,并将执行结果放入到CUX_BOM_ID里面 CREATE OR REPLACE procedure CUX_BOM is ? cursor emp_cursor is select segment1 ? from (select mtl.segment1, mtl.description ????????? from bom_bill_of_materials a, MTL_SYSTEM_ITEMS_B mtl ???????? where a.ASSEMBLY_ITEM_ID = mtl.inventory_item_id ?????????? and a.ORGANIZATION_ID = anization_id ?????????? and anization_id = 101 ????????? ) a ?where not exists ?(select * ????????? from (select mtl2.segment1, mtl2.description ????????????????? from bom_inventory_components bom, MTL_SYSTEM_ITEMS_B mtl2 ???????????????? where bom.COMPONENT_ITEM_ID = mtl2.inventory_item_id ?????????????????? and anization_id = 101 ?????????????????? ) b where? a.segment1 = b.segment1) and rownum15; begin ? FOR emp_record in EMP_CURSOR loop ?? insert into cux_bom_id select kindid, ?????? lpad(|---, (level - 1) * 4, ) || lpad(『, 2) || kindname || ?????? rpad(』, 2) kindname,fatherid,emp_record.segment1 id ??? from ? (select mtl.segment1 kindid,mtl.description kindname,mtl2.segment1 fatherid ? from bom_bill_of_materials a, ?????? bom_inventory_components b, ??????? MTL_SYSTEM_ITEMS_B mtl, ??????? MTL_SYSTEM_ITEMS_B mtl2 ?where a.bill_sequence_id = b.BILL_SEQUENCE_ID ?? and mtl.inventory_item_id=b.COMPONENT_ITEM_ID ?? and a.ASSEMBLY_ITEM_ID=mtl2.inventory_item_id ?? and anization_id=101 ?? and anization_id=101 ?? and a.ORGANIZATION_ID=101 ?? and mtl.invoice_enabled_flag=Y ?? and anization_id=a.ORGANIZATION_ID ??? ) ?? CONNECT BY PRIOR kindid = fatherid ? START WITH fatherid = emp_record.segment1 ??? order by kindid desc; ????? commit; ? end loop; ? end; --执行存储过程CUX_BOM BEGIN CUX_BOM; END; --查询即可运行得到的结果 SELECT * FROM CUX_BOM_ID;

文档评论(0)

137****6572 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档