免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2191 | 回复: 0
打印 上一主题 下一主题

求助,存储过程不能够执行问题。 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-05-27 17:33 |只看该作者 |倒序浏览
为了将数据库中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.请各位高手指点一下 :) 多谢了
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP