数据库:Interbase 6.5 连接:与 IBX 或 BDE 相同的结果 程序是用 delphi 7 编写的
我尝试更新 th sp。结果“Token unknown -line xx, char yy” Line xx 和 char yy 指向第一个变量。
例子:
query.sql.add('ALTER PROCEDURE');
query.sql.add('MYPROCEDURE (mypkey integer)');
query.sql.add('returns (myresult integer)');
query.sql.add('as');
query.sql.add('declare variable helpint integer;');
query.sql.add('BEGIN');
query.sql.add('select count(bla)');
query.sql.add('from mytable');
query.sql.add('where pkey=:mypkey');
query.sql.add('into :helpint;'); <------ here is line xx
query.sql.add('if (helpint>0) then myresult = 1;');
query.sql.add('suspend;');
query.sql.add('END');
try
query.ExecSQL;
except
on E:Exception do
begin
E.Message := E.Message +#13#10+query.SQL.Text;
raise;
end;
如果我用 ibconsole 更新 sp,它可以工作。
怎么了?
更新:
在原始代码中,它是 decalred 变量!
更正:
query.sql.add('into :helpint;'); <------ here is line xx
query.sql.add('if (helpint>0) then myresult = 1;');