fuzzy query in windows batch shell
In sqlplus: select 'del ' || file_name||';' from dba_data_files where tablespace_name like 'SHFRM%' ;
In batch shell(not work):
set var=%1
@echo off
(
echo / as sysdba
echo set cmdsep on
echo set cmdsep '"'; --"
echo "set head off"
echo "set feedback off"
echo "spool file.sql"
echo "select 'del ' || file_name||';' from dba_data_files where tablespace_name like '%var%%';"
::echo "prompt EXIT;"
echo "spool off"
) | sqlplus -s
I ran the batch:< batch.bat SHFRM >in windows cmd, no result spooled in file.sql,there might be mistake in batch,please help...