- 论坛徽章:
- 0
|
为了将数据库中servicelevel=3的行的实现sreserveperiod=sservicestop+93的UPdate操作编写了下面的存储过程。
drop procedure upd_servicestop;
create procedure upd_servicestop()
--returning int,int;
define i_succeedno int;
define i_failno int;
define i,j,l int;
define i_account char(12); ---定义卡号
define s_servicestop char( ;
define s_resperiodi char( ;
define s_resperiodinow char( ;
define s_servicelevel char(1);
define i_moredays int;
let i=0;
let j=0;
let l=0; ---给i,j,l付初值
let i_moredays = 93;
set debug file to "update_servicestop.log";
trace on;
--on exception
-- return -1, -1;
--end exception
set lock mode to wait 5;
let i_succeedno = 0;
let i_failno = 0;
begin work;
foreach up_cur with hold for
select saccountnumber, sservicestop, sreserveperiod, sservicelevel
into i_account, s_servicestop, s_resperiodi, s_servicelevel from basetab_ccs
where sservicelevel="3" and sservicestop <>; sreserveperiod
let s_resperiodinow = to_char((to_date(s_servicestop, '%Y%m%d')
+ (i_moredays) units DAY), '%Y%m%d');
update basetab_ccs set sreserveperiod = s_resperiodinow
where current of up_cur;
if dbinfo('sqlca.sqlerrd2') < 1 then
let i_failno = i_failno + 1;
insert into card_tmp values (i_account);
else
let i_succeedno = i_succeedno + 1;
end if;
let i=i+1;
let l=i-j;
if l=3000 then
commit work;
begin work;
let j=i;
end if;
end foreach;
if l!=3000 then
commit work;
--return i_succeedno,i_failno;
end if;
end procedure;
---set isolation dirty read;
execute procedure upd_servicestop();
但是执行时出现如下的报错:
Database selected.
Routine dropped.
Routine created.
1277: Input does not match format specification.
Error in line 69
Near character position 34
Data committed.
Database closed.
从存储过程的debug中看到如下的内容
trace on
set lock mode to wait 5;
let i_succeedno = 0
let i_failno = 0
begin work;
start select cursor.
"0$up_cur" is with hold select saccountnumber, sservicestop, sreserveperiod, sservice
level
from basetab_ccs
where (and (= sservicelevel, "3" , (<>; sservicestop, sreserveperiod))
for update of sreserveperiod
select cursor iteration.
select cursor returns 246813570000 , 20050931 , 20051231 , 3
exception : looking for handler
SQL error = -1277 ISAM error = 0 error string = = ""
exception : no appropriate handler
这里的SQL error=-1277
-1277 Input does not match format specification.
Check that the ASCII string that contains a DATETIME or INTERVAL value
conforms to the format string. For example, a percent character in a
DATETIME or INTERVAL ASCII string must have a matching "%%" sequence in the
format string. See also the discussion of the DBTIME environment variable in
the IBM Informix Guide to SQL: Reference.
但是不知道那句导致的Input does not match format specification.请各位高手指点一下 :) 多谢了 |
|