壹佰网|ERP100 - 企业信息化知识门户

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 3216|回复: 2

请问如何优化这个script

[复制链接]
发表于 2006/11/7 10:34:35 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。如果您注册时有任何问题请联系客服QQ: 83569622  。

您需要 登录 才可以下载或查看,没有帐号?注册

x
這個script效能很差,有辦法優化嗎?
select
bd.department_code dep_code,
sys.inventory_item_id item_id,
sys.planner_code ,
to_char(wdj.scheduled_completion_date,'RRRR') || to_char(wdj.scheduled_completion_date,'WW') weeks,
wdj.scheduled_completion_date
from wip_discrete_jobs wdj,
     wip_operations wo,
     bom_departments bd,
            mtl_system_items_kfv sys
where wdj.organization_id = :v_org_id
  and bd.organization_id = :v_org_id
  and wdj.wip_entity_id = wo.wip_entity_id
  and wo.department_id = bd.department_id
  and wdj.status_type =3
  and sys.organization_id = :v_org_id
  and sys.inventory_item_id = wdj.primary_item_id
  and wdj.wip_entity_id in
      (select job.wip_entity_id from wip_discrete_jobs job,wip_operations wo,bom_departments bd1
       where job.organization_id = :v_org_id and bd1.organization_id = :v_org_id
         and job.wip_entity_id = wo.wip_entity_id and wo.department_id = bd1.department_id
         and bd1.department_code <= bd.department_code and job.status_type =3
         and nvl(wo.quantity_in_queue,0) + nvl(wo.quantity_running,0) >0
         and to_char(wdj.scheduled_completion_date,'RRRR') = to_char(:v_plan_date,'RRRR')
         and to_char(wdj.scheduled_completion_date,'WW') = to_char(:v_plan_date,'WW')         
        group by job.wip_entity_id)         
  and to_char(wdj.scheduled_completion_date,'RRRR') = to_char(:v_plan_date,'RRRR')
  and to_char(wdj.scheduled_completion_date,'WW') = to_char(:v_plan_date,'WW')
group by  bd.department_code ,
sys.inventory_item_id ,
sys.planner_code ,
to_char(wdj.scheduled_completion_date,'RRRR'),
to_char(wdj.scheduled_completion_date,'WW') ,
wdj.scheduled_completion_date
发表于 2006/11/7 11:16:55 | 显示全部楼层
关注
发表于 2006/11/15 15:12:10 | 显示全部楼层
select
bd.department_code dep_code,
sys.inventory_item_id item_id,
sys.planner_code ,
to_char(wdj.scheduled_completion_date,'RRRR') || to_char(wdj.scheduled_completion_date,'WW') weeks,
wdj.scheduled_completion_date
from wip_discrete_jobs wdj,
     wip_operations wo,
     bom_departments bd,
            mtl_system_items_kfv sys
where wdj.organization_id = :v_org_id
  and bd.organization_id = :v_org_id
  and wdj.wip_entity_id = wo.wip_entity_id
  and wo.department_id = bd.department_id
  and wdj.status_type =3
  and sys.organization_id = :v_org_id
  and sys.inventory_item_id = wdj.primary_item_id
--  and wdj.wip_entity_id in
  AND EXISTS
      (select job.wip_entity_id
            from wip_discrete_jobs job,wip_operations wo,bom_departments bd1
       where job.organization_id = :v_org_id
             and bd1.organization_id = :v_org_id
         and job.wip_entity_id = wo.wip_entity_id and wo.department_id = bd1.department_id
         and bd1.department_code <= bd.department_code and job.status_type =3
         and nvl(wo.quantity_in_queue,0) + nvl(wo.quantity_running,0) >0
         and to_char(wdj.scheduled_completion_date,'RRRR') = to_char(:v_plan_date,'RRRR')
         and to_char(wdj.scheduled_completion_date,'WW') = to_char(:v_plan_date,'WW')
                 AND job.wip_entity_id = wdj.wip_entity_id  )      
--        group by job.wip_entity_id)         
  and to_char(wdj.scheduled_completion_date,'RRRR') = to_char(:v_plan_date,'RRRR')
  and to_char(wdj.scheduled_completion_date,'WW') = to_char(:v_plan_date,'WW')
group by  bd.department_code ,
sys.inventory_item_id ,
sys.planner_code ,
to_char(wdj.scheduled_completion_date,'RRRR'),
to_char(wdj.scheduled_completion_date,'WW') ,
wdj.scheduled_completion_date
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|手机版|壹佰网 ERP100 ( 京ICP备19053597号-2 )

Copyright © 2005-2012 北京海之大网络技术有限责任公司 服务器托管由互联互通
手机:13911575376
网站技术点击发送消息给对方83569622   广告&合作 点击发送消息给对方27675401   点击发送消息给对方634043306   咨询及人才点击发送消息给对方138011526

GMT+8, 2025/11/30 07:05 , Processed in 0.018112 second(s), 16 queries , File On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表