@echo off rem ----------------------------------------------------------------------- rem Filename: RunSql.bat rem Purpose: Run SQL*Plus script from DOS batch file rem Date: 05-Mar-2002 rem Author: Frank Naude, Oracle FAQ rem ----------------------------------------------------------------------- rem -- Accept command line arguments -- rem Note: %1 is the first command line argument, %2 the second, etc. if "%1" == "" goto Usage set TNAME=%1 echo Command Line Argument: %TNAME% rem -- Create sql script -- rem Use double '%' when a real '%' character is needed echo connect scott/tiger@orcl >%0.tmp echo select * from tab where tname like '%%%TNAME%%%'; >>%0.tmp echo accept x prompt "Press any key to exit" >>%0.tmp echo exit 8; >>%0.tmp rem -- Run sql script -- sqlplus /nolog @%0.tmp rem -- Cleanup -- del %0.tmp goto End :Usage echo Usage: %0 TABLE_NAME :End