我试图在shell中从informix的存储过程中卸载数据,但在执行shell脚本时出现错误。
我的Shell文件
FILE="customer_report"
PATH="/home/usrrep/DIR_1/DIR_2/"
EXT=".txt"
dbaccess dataBase <<eof
unload to $PATH$FILE$1$EXT delimiter ','
execute procedure database:customerReports();
eof
echo Serial Number,Name,Office,Status,Product,Date,Phone1,Phone2,Email,Final Reult> $PATH$FILE$1.csv
cat $PATH$FILE$1$EXT >> $PATH$FILE$1.csv
exit 0在执行查询时,shell运行得很好,但当我尝试执行Store过程时,会抛出下一个错误:
809: SQL Syntax error has occurred.
Error in line 2
Near character position 0这个错误很明显,但我不知道发生了什么
提前感谢
发布于 2017-07-25 21:13:37
卸载到...执行过程...似乎不存在,除非没有记录。一种可能是在customerReports()中使用
select ... from ...into temp mytemptable和
unload to ... select * from mytemptable 在shell脚本中。
发布于 2017-07-26 20:51:15
您可以尝试使用from table()。就像这样:
> create procedure p2(c1 int) returning int,char(10)
return 1,'aaa' with resume;
return 2,'bbb' with resume;
end procedure;
Routine created.
> execute procedure p2(1);
(expression) (expression)
1 aaa
2 bbb
2 row(s) retrieved.
> unload to x.unl select * from table(p2(1));
2 row(s) unloaded.
> !cat x.unl
1|aaa|
2|bbb|
>https://stackoverflow.com/questions/45246987
复制相似问题