我现在贴代码:请大家看看是怎么回事 declare cc varchar2(8); begin select bbrq into cc from lpy where bbrq=to_char(sysdate-1,'yyyymmdd') group by bbrq; if cc=to_char(sysdate-1,'yyyymmdd') then exit; else --总贷款 update lpy set(zdk)=(select sum(tddrbal)/100 from icbcmfors.prn_acc_day where substr(subno,1,4) in('1210','1220', '1240','1500','1230','1610','1611','1612','2390','1580','1590','1185','2285', '1410','1420','1501','1560','1470','1450','1440','1445','1430') and brno='8550' and currtype='001') where brno='8550' and bbrq=to_char(sysdate-1,'yyyymmdd');--对公存款 declare dd2 number(17,2); dd1 number(17,2); dd number(17,2); begin select sum(tdcrbal)/100 into dd1 from icbcmfors.prn_acc_day where substr(subno,1,4) in('2010','2170','2910','2195','2190','2198','2240','2021','2192','2197','2020', '2191','2196','2241','2330','2310') and brno='8550' and currtype='001'; select sum(tdcrbal)/100 into dd2 from icbcmfors.prn_acc_day where subno in('211001','211002', '211003','211004','211009','211010','211013') and brno='8550' and currtype='001'; if dd2 is null then dd2:=0; end if; dd:=dd1+dd2; update lpy set dgck=dd where brno='8550' and bbrq=to_char(sysdate-1,'yyyymmdd'); end; / end if; end; /
declare cursor t_sor is select bbrq from lpy where bbrq=to_char(sysdate-1,'yyyymmdd') group by bbrq; begin for v_sor in t_sor loop if v_sor.bbrq=to_char(sysdate-1,'yyyymmdd') then exit; else .....
select bbrq into cc from lpy where bbrq=to_char(sysdate-1,'yyyymmdd') group by bbrq; 给成 select max(bbrq) into cc from lpy where bbrq=to_char(sysdate-1,'yyyymmdd');然后你把下边语句的执行(sql/plus)结果贴出来 select max(bbrq) from lpy; 我认为问题就应该在这儿
Oracle8 Enterprise Edition Release 8.0.5.0.0 - Production PL/SQL Release 8.0.5.0.0 - Production SQLWKS> declare 2> cc varchar2(8); 3> begin 4> select max(bbrq) into cc from lpy where bbrq=to_char(sysdate-1,'yyyymmdd'); 5> select max(bbrq) from lpy; 6> end; 7> / select max(bbrq) from lpy; * ORA-06550: 行5、列1: PLS-00428: 在此 SELECT 语句中缺少 INTO 子句 ORA-06550: 行5、列1: PL/SQL: SQL Statement ignored
你就单独执行一句 select max(bbrq) from lpy 前边申明以及其他都去掉 是想看你表中的数据是什么样子的
Oracle8 Enterprise Edition Release 8.0.5.0.0 - Production PL/SQL Release 8.0.5.0.0 - Production SQLWKS> select max(bbrq) from lpy; MAX(BBRQ -------- 20030305 已选择 1 行。
退出该程序;
else
一段程序;
end if;
http://www.codeclub.net/bbs/
declare
cc varchar2(8);
begin
select bbrq into cc from lpy where bbrq=to_char(sysdate-1,'yyyymmdd') group by bbrq;
if cc=to_char(sysdate-1,'yyyymmdd') then
exit;
else
--总贷款
update lpy set(zdk)=(select sum(tddrbal)/100 from icbcmfors.prn_acc_day where
substr(subno,1,4) in('1210','1220',
'1240','1500','1230','1610','1611','1612','2390','1580','1590','1185','2285',
'1410','1420','1501','1560','1470','1450','1440','1445','1430') and brno='8550'
and currtype='001') where brno='8550' and bbrq=to_char(sysdate-1,'yyyymmdd');--对公存款
declare
dd2 number(17,2);
dd1 number(17,2);
dd number(17,2);
begin
select sum(tdcrbal)/100 into dd1 from icbcmfors.prn_acc_day where substr(subno,1,4)
in('2010','2170','2910','2195','2190','2198','2240','2021','2192','2197','2020',
'2191','2196','2241','2330','2310') and brno='8550' and currtype='001';
select sum(tdcrbal)/100 into dd2 from icbcmfors.prn_acc_day where
subno in('211001','211002',
'211003','211004','211009','211010','211013') and brno='8550' and currtype='001';
if dd2 is null then
dd2:=0;
end if;
dd:=dd1+dd2;
update lpy set dgck=dd where brno='8550' and bbrq=to_char(sysdate-1,'yyyymmdd');
end;
/
end if;
end;
/
cursor t_sor is
select bbrq from lpy where bbrq=to_char(sysdate-1,'yyyymmdd') group by bbrq;
begin
for v_sor in t_sor loop
if v_sor.bbrq=to_char(sysdate-1,'yyyymmdd') then
exit;
else
.....
给成
select max(bbrq) into cc from lpy where bbrq=to_char(sysdate-1,'yyyymmdd');然后你把下边语句的执行(sql/plus)结果贴出来
select max(bbrq) from lpy;
我认为问题就应该在这儿
PL/SQL Release 8.0.5.0.0 - Production
SQLWKS> declare
2> cc varchar2(8);
3> begin
4> select max(bbrq) into cc from lpy where bbrq=to_char(sysdate-1,'yyyymmdd');
5> select max(bbrq) from lpy;
6> end;
7> /
select max(bbrq) from lpy;
*
ORA-06550: 行5、列1:
PLS-00428: 在此 SELECT 语句中缺少 INTO 子句
ORA-06550: 行5、列1:
PL/SQL: SQL Statement ignored
select max(bbrq) from lpy
前边申明以及其他都去掉
是想看你表中的数据是什么样子的
PL/SQL Release 8.0.5.0.0 - Production
SQLWKS> select max(bbrq) from lpy;
MAX(BBRQ
--------
20030305
已选择 1 行。