如何判断刚才执行的sql是否成功?
存储过程中需要判断刚才执行的sql(比如select、update、delete)是否成功?请问informix有什么方法返回该值么?DBINFO(‘SPECIAL_KEYWORD') 函数是否可以实现?另外哪位大虾有dbinfo函数的详细用法麻烦共享下,谢谢 在存储过程的开始定义变量define li_sqlerr,li_isamerrno integer;
define ls_errmsg varchar(160);
然后
let li_sqlerr = 0; --这个非常重要
然后
on exception set li_sqlerr,li_isamerrno,ls_errmsg
end exception with resume;
然后
select 语句;
if li_sqlerr = 0 then --语句执行成功
end if
if li_sqlerr = 100 then --语句没有返回值
end if
if li_sqlerr < 0 then
--处理语句
。。。。
let li_sqlerr = 0; --非常重要,一定要设置为0,为下一个语句判断做准备
end if
页:
[1]