服务器 频道

informix存储过程

  【IT168 服务器学院】在存储过程中变量定义完毕写如下代码:
  int li_sqlerr;

  on exception set li_sqlerr
  end exception with resume;

  let li_sqlerr = 0;

  然后:
  select * from table1 where 条件……;
  if li_sqlerr = 0 then
  执行 delete
  elif li_sqlerr = 100 then
  let li_sqlerr = 0; --这里一定要将li_sqlerr复原为0,在insert之后才能再判断li_sqlerr的值
  执行 insert..
  elif li_sqlerr < 0 then --sqlcode <0 出错了
  let li_sqlerr = 0;
  错误处理语句
  end if
  

0
相关文章