Escape special character

Hi,
How to use * in call to pl/sql block from shell script?
The line "select * from" is causing all files and directiores to show up in email notification but if I give all column names then it works,
Please let me know how to use '*' instead of giving all column names, in other wirds how to escape special character * ?

--shell script
${ORACLE_HOME}/bin/sqlplus ${ORACLE_USER}/${ORACLE_PASSWD}@${ORACLE_SID} << EOF > ${TMP_LOG_FILE} 2>&1
set serveroutput on
@${CREATE_STAGE_SQL} ${i}
COMMIT;
QUIT;
EOF

---sql to create staging table
declare
v_sql_string varchar2(4000);
begin
# some code
     execute immediate 'create table t1_rpt_&1._stg as select * from t1_rpt_tmt';
end;

thanks
sandy

I don't know of a way to escape a character once it's already inside a string. That kind of expansion is supposed to happen when something is assigned, not later.

You may be able to tell the shell not to expand *'s instead. set -f should disable * expansion, set +f should turn it back on.

This is a duplicate thread

I suggested to disable path name expansion (aka globbing) in OP's previous post, but OP didn't mention anything about if that helped or not!

1 Like