sql commands in cmd file
153166Sep 18 2009 — edited Sep 21 2009I have been forced to write some simple scripts for Windows users who use Oracle. I used to write in bash/ksh and have no experience at all about windows scripts. What I figured out is :
cmd file:
echo off
set script_dir= .
set log=%script_dir%\log\db.log
set scrsql=%script_dir%\db.sql
sqlplus /nolog @%scrsql% >> %log%
so my questions are :
- I would like to have all commands ( batch and sql) visible inside cmd file. Is it any way to put sql commands line by line into cmd file ?
- how to redirect output of sql command ( for example simple select ) to screen or file
- how to put external parameter into sql command ( for example select xx from yy where zz=@param)
KP>