请问有什么问题?
RETVAL=`sqlplus -s user/pass@DB <<EOF
SET TRIMSPOOL ON PAGESIZE 0 COLSEP , FEEDBACK OFF VERIFY OFF HEADING OFF ECHO OFF
SELECT process_id, source, destination, type FROM table WHERE process_id IN ('123','456');
EXIT;
EOF`
if [ -z "$RETVAL" ]; then
echo "No rows returned from database"
exit 0
else
echo $RETVAL
fi
输出结果为:
123,a c,2 456,a c,5
应该是:
123, a, c, 2
456, a, c, 5
答案 0 :(得分:3)
你试过吗
echo "$RETVAL"
在命令行或shell脚本中解释的未加引号变量的性质是去除“外部”格式。 ; - )
IHTH