执行EXEC SQM_RESULT_PRO ;
ORA-06502: PL/SQL: 数字或值错误
ORA-06512: 在"TELEUSER.SQM_RESULT_PRO", line 30
ORA-06512: 在line 2
create or replace procedure SQM_RESULT_PRO is
str varchar2(4096);--最终拼的字符串
str2 varchar2(4096);--最终拼的字符串
ndate varchar2(64); --当天日期
cnum NUMBER(6);--当天的条数
CURSOR resname1 IS select resname from sqm_result_log where restype='1';
CURSOR resname2 IS select resname from sqm_result_log where restype='2';
begin
--开始
select to_char(sysdate,'yyyy-MM-dd') into ndate from dual;
select count(*) into cnum from sqm_result_log where to_char(restime,'yyyy-MM-dd')=ndate;
--判断当天的是否为6个文件
if cnum = 6 then
--系统运行正常
str:='系统运行正常';
else if cnum<6 then
--系统运行不正常
str:='系统运行不正常';
end if;
end if;
--open resname1 for select resname from sqm_result_log where restype='1';
--close resname1;
--open resname2 for select resname from sqm_result_log where restype='2';
--close resname2;
OPEN resname1;
loop
fetch resname1 into str2;
str:=str||' '||str2;
exit when resname1 % NOTFOUND;
end loop;
CLOSE resname1;
str2:='';
OPEN resname2;
loop
fetch resname2 into str2;
str:=str||' '||str2;
exit when resname2 % NOTFOUND;
end loop;
CLOSE resname2;
insert into testsqm values(str);
end SQM_RESULT_PRO;
insert into testsqm values(str);
插入的时候这个testsqm 表改成long类型的?改完了然后str没有数据啊。。str查询出来的东西必定是有数据的啊。这个怎么检查呢?用pl/sql
testsqm 表的结构什么样,发出来
追问..忘记贴了。就这一个字段啊。。测试能不能插进去
create table TESTSQM
(
TEST LONG
)
tablespace USERS
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64K
minextents 1
maxextents unlimited
);
在insert into testsqm values(str); --之后,需要提交,增加
commit;
然后执行过程,执行后查询TESTSQM表中数据就行了。