2

请问这里有什么问题吗?

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
4

1 回答 1

4

你试过了吗

 echo "$RETVAL" 

在命令行或 shell 脚本中解释的未引用变量的性质是去除“无关”的格式。;-)

IHTH

于 2013-06-28T01:15:19.370 回答