脚本中telnet处理DB2的SQL问题
我有个SHELL脚本,里面写了一段telnet处理导出数据文件。大概例子如下所示:
(echo "usr"
sleep 1
echo "passwd"
sleep 1
echo "db2 connect to dbtemp user ... using ..."
sleep 1
echo "db2 'export to temp.ixf of ixf select substr(char(current date),1,4)||'/'||substr(char(current date),5,6) as inputdate from temp_tab where id in('001','002') with ur '"
sleep 1
echo "db2 terminate"
echo "exit")|telnet 192.168.1.3
现在执行的时候就一直报错,说有非法字符。就是日期处理这里。一直认为 substr(char(current date),1,4)||'/'||substr(char(current date),5,6) as inputdate 这里面的斜杠“/”是非法字符.如果把这段去掉,输出其它字段就没问题了.
请哪位遇到过类似情况的高手帮解决一下.我需要输出带斜杠的日期.