A
avay
Unregistered / Unconfirmed
GUEST, unregistred user!
小弟在为interbase数据库编写的触发器中声明了一个光标,系统提示出错。
原SQL代码如下:set term !!;
create trigger tr_kmh_i for kmh after insert
as
declare variable kmh char(6); declare variable kmh_attrib int;
declare variable ye float; declare variable jh char(3);
declare variable fsrq char(10);
begin
ye=0.00;jh='000';fsrq=' ';
kmh=new.kmh; kmh_attrib=new.kmh_attrib;
if (kmh_attrib=1) then
begin
jh='000';
insert into acount_ye valueskmh,:jh,:fsrq,:ye);
end
if (kmh_attrib=2) then
begin
declare kmh_i_cur cursor for
select unitno from unit where unitno<>'000'
for update of unitno;
open kmh_i_cur;
fetch kmh_i_cur into :jh;
while (!sqlcode)
begin
insert into acount_ye valueskmh,:jh,:fsrq,:ye);
fetch kmh_i_cur into :jh;
end
close kmh_i_cur
end
end!!
set term ;!!
在dos方式下用isql.exe执行后提示出错信息如下:
dynamic sql error
-sql error code= -104
-token unknow - line 18 char 14
-declare
有那位大侠知晓内情,请指点以下迷津
email:avay_wang@yahoo.com
原SQL代码如下:set term !!;
create trigger tr_kmh_i for kmh after insert
as
declare variable kmh char(6); declare variable kmh_attrib int;
declare variable ye float; declare variable jh char(3);
declare variable fsrq char(10);
begin
ye=0.00;jh='000';fsrq=' ';
kmh=new.kmh; kmh_attrib=new.kmh_attrib;
if (kmh_attrib=1) then
begin
jh='000';
insert into acount_ye valueskmh,:jh,:fsrq,:ye);
end
if (kmh_attrib=2) then
begin
declare kmh_i_cur cursor for
select unitno from unit where unitno<>'000'
for update of unitno;
open kmh_i_cur;
fetch kmh_i_cur into :jh;
while (!sqlcode)
begin
insert into acount_ye valueskmh,:jh,:fsrq,:ye);
fetch kmh_i_cur into :jh;
end
close kmh_i_cur
end
end!!
set term ;!!
在dos方式下用isql.exe执行后提示出错信息如下:
dynamic sql error
-sql error code= -104
-token unknow - line 18 char 14
-declare
有那位大侠知晓内情,请指点以下迷津
email:avay_wang@yahoo.com