批处理语句中不允许使用结果集-sql anywhere

kh212irz  于 2021-07-29  发布在  Java
关注(0)|答案(1)|浏览(387)

我是sql anywhere的新手。我将表名作为输入参数传递。我想同时运行delete和select语句。我不知道我在哪里漏掉了逻辑。你能帮我做这个吗。
我的程序是

ALTER PROCEDURE "dba"."spCallTrigger"(
  /* @parameter_name parameter_type [= default_value] [OUTPUT], ... */
                                       @TableName varchar(25) )
AS
BEGIN
    /* Type the procedure statements here */

//Exec "dba"."spCallTrigger" 'GTempTable'

SET OPTION ISQL_PRINT_RESULT_SET='ALL';

DECLARE @sql LONG VARCHAR
SET @sql = 'delete from dba.' + @TableName + ' where 1=2'
Execute ( @sql )

DECLARE @command LONG VARCHAR
SET @command = 'select * from dba.' + @TableName + 'Audit'
Execute ( @command )

END
cygmwpex

cygmwpex1#

EXECUTE IMMEDIATE WITH RESULT SET ON  @command

这可能有用。

相关问题