| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1482 人关注过本帖
标题:这样怎么引用不到表
只看楼主 加入收藏
shizhusz110
Rank: 1
等 级:新手上路
帖 子:307
专家分:0
注 册:2006-12-21
收藏
 问题点数:0 回复次数:2 
这样怎么引用不到表
create or replace procedure UpdateAllSHGL_CJForDate
(
 i_date in date
)
as
 tableStr varchar(2048):='CREATE   GLOBAL   TEMPORARY   TABLE  ChangeData(
                         hm varchar(20),
                         a1 number(10,2),
                         hmlb char(1),
                         b1 number(10,2),
                         c1 number(10,2),
                         d1 number(10,2),
                         total number(10,2),
                         total1 number(10,2),
                         total2 number(10,2))ON   COMMIT   P   RESERVE   ROWS';
  changeHuafei varchar(1024):='CREATE   GLOBAL   TEMPORARY   TABLE  CjTable(
                               hm varchar(20),
                               total number(10,2),
                               i_hmcj number(10,2),
                               i_sbcj number(10,2))ON   COMMIT   P   RESERVE   ROWS';
  changeTableDataStr varchar(64):='CREATE   GLOBAL   TEMPORARY   TABLE  LinShi(
                                  hm varchar(20),
                                  i_yfcj number(10,2))ON   COMMIT   P   RESERVE   ROWS';
 chaneDateStr varchar(16);
 changedDate date;
 H1  number(10,2):=0.49;--公话号码设备比率--号码
 S1  number(10,2):=0.41;--公话号码设备比率--设备
 H2  number(10,2):=0.25;--商话号码设备比率--号码
 S2  number(10,2):=0.25;--商话号码设备比率--设备
 F1  int:=100000;
 G1  int:=100;
 I1  number(10,2):=0.05;
 F2  int:=200000;
 G2  int:=100;
 I2  number(10,2):=0.10;
 E1  int:=30;
 E2  int:=60;
 i_dlsbh number;
 i_sbdls number;
begin
 -----------------------------
 select to_char(i_date,'YYYY-MM') into chaneDateStr from dual;
 select to_date(chaneDateStr,'YYYY-MM') into changedDate from dual;
 -----------------------------
 select sum(DLSBH) into i_dlsbh from SHGL_CJQD where CJRQ=i_date;--代理商编号
 select sum(DLSBH_SB) into i_sbdls  from SHGL_CJQD where CJRQ=i_date;--设备代理商编号
 --------------------------------
 execute immediate tableStr;
 execute immediate changeHuafei;
 execute immediate changeTableDataStr;
 select HM,BDHF,HMLB,BDGJ,BDCT,YHL,BDHF+BDCT+BDGJ,BDCT*3/1+BDGJ,(1-YHL)*(BDHF+BDCT+BDGJ) into ChangeData.hm,ChangeData.a1,ChangeData.hmlb,ChangeData.b1,ChangeData.c1,ChangeData.d1,ChangeData.total,ChangeData.total1,ChangeData.total2 from SHGL_CJQD where CJRQ=changedDate;
 select hm,total,H1*total2,S1*total2 into CjTable.hm,CjTable.total,CjTable.i_hmcj,CjTable.i_sbcj from ChangeData where hmlb='1' and (total>=E1 or i_dlsbh=i_sbdls);
 select hm,total,H1*total2,S1*total2  into CjTable.hm,CjTable.total,CjTable.i_hmcj,CjTable.i_sbcj from ChangeData where hmlb='2' and total>=F2 and total>=G2;
 select hm,total,H1*total2,S1*total2 into CjTable.hm,CjTable.total,CjTable.i_hmcj,CjTable.i_sbcj from ChangeData where hmlb='2' and ((total1>=E2 and total<G2 )or i_dlsbh=i_sbdls)and total>=F2;
 select hm,total,H1*total2,S1*total2 into CjTable.hm,CjTable.total,CjTable.i_hmcj,CjTable.i_sbcj from ChangeData where hmlb='2' and (total>=F1 and total<F2) and total>=G1;
 select hm,total,H1*total2,S1*total2 into CjTable.hm,CjTable.total,CjTable.i_hmcj,CjTable.i_sbcj from ChangeData where hmlb='2' and (total>=F1 and total<F2) and ((total1>=E2 and total1<G1)or (i_dlsbh=i_sbdls));
 select hm,total,H1*total2,S1*total2 into CjTable.hm,CjTable.total,CjTable.i_hmcj,CjTable.i_sbcj from ChangeData where hmlb='2' and total<F1 and (total1>=E2 or i_dlsbh=i_sbdls);
 --------------------------------------------------------------
select hm,i_hmcj+i_sbcj  into LinShi from CjTable where i_dlsbh=i_sbdls;
select hm,i_hmcj into LinShi from CjTable where i_dlsbh!=i_sbdls;
 --------------------------------------------------------------
 update SHGL_CJQD aa
  set aa.TOTAL=(select total from CjTable bb where aa.HM=bb.hm),
     aa.HMCJ=(select i_hmcj from CjTable bb where aa.HM=bb.hm),
     aa.SBCJ=(select i_sbcj from CjTable bb where aa.HM=bb.hm)
 where exists(select 1 from CjTable bb where aa.HM=bb.hm) ;
 ---------------------------------------------------------------------
 update SHGL_CJQD aa
  set
     aa.YHCJ=(select i_yfcj from LinShi bb where aa.HM=bb.hm)
 where exists(select 1 from LinShi bb where aa.HM=bb.hm) ;
end;
-------
谢谢!
搜索更多相关主题的帖子: number date varchar procedure TABLE 
2008-03-01 16:17
ILoveMK
Rank: 3Rank: 3
等 级:新手上路
威 望:6
帖 子:487
专家分:0
注 册:2007-2-12
收藏
得分:0 
请把错误提示贴出来,谢谢。

天下归心
2008-03-01 19:58
shizhusz110
Rank: 1
等 级:新手上路
帖 子:307
专家分:0
注 册:2006-12-21
收藏
得分:0 
ChangeData这些没有引用到!!!!!!!!!!!!
2008-03-02 10:22
快速回复:这样怎么引用不到表
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.037984 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved