首页 > 解决方案 > oracle sqlplus select query with apostrophe converts to?

问题描述

sqlplus -s ${uidpwd} > ${TEMP_FILE} 2>${LOG_FILE} << EOF

SET LINESIZE 32767
SET PAGESIZE 0
set long 2000000000
set longchunksize 10000000

SET TRIMSPOOL ON
SET RECSEP OFF
SET HEADSEP OFF
SET HEADING OFF
SET FEEDBACK OFF
SET SERVEROUTPUT ON
SET ECHO OFF
SET VERIFY OFF

whenever oserror exit 9
whenever sqlerror exit sql.sqlcode
Select description from table;
exit;
EOF

This is returning me with ? for all names having "apostrophe'

Actual:

Result:

After generating file (spool result) I tried this way "sed "s/?/'/g" ${TEMP_FILE}" -- this is not working and also this could replace "?" in the column values like "what is your name?" to "what is your name' ".

标签: oracleunixsqlplus

解决方案



推荐阅读