卸载语句在 Sybase IQ 的开始结束块内不起作用

Unload Statement not working inside begin end block in Sybase IQ

我有一个 sybaseiq_file.sql 文件,其中包含以下代码

   begin
         select col1,col2, ROW_NUMBER() OVER (PARTITION BY col3 ORDER BY col1) as v_order    into #tmptbl from tbl    
        UNLOAD TABLE #tmptbl TO 'Vinoth.dat'
        drop table #tmptbl
    end

我想将 select 语句的输出推送到一个文件。

但是在执行时出现以下错误。请帮助解决这个问题。

 dbisqlc -c "uid=XXX;pwd=XXX;eng=XXX;links=tcpip(host=XXX;port=XXX)" -q sybaseiq_file.sql

Error in file "sybase_fileiq.sql" at line 0
Syntax error near 'UNLOAD' on line 2

使用下面重新编写的代码解决了问题

 begin
         select col1,col2, ROW_NUMBER() OVER (PARTITION BY col3 ORDER BY col1) as v_order    into #tmptbl from tbl    
        select * from #tmptbl ># 'Vinoth.dat'
        drop table #tmptbl
    end