Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

sql commands in cmd file

153166Sep 18 2009 — edited Sep 21 2009
I 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>
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 19 2009
Added on Sep 18 2009
4 comments
586 views