Dear All,
I have to create a batch file containing following syntax. How can I create batch file. Please help.
sqlplus / as sysdba;
sql> update
sql> MyTable
sql> SET MyColumn ='Y'
sql> WHERE MyColumn ='N';
sql> COMMIT;
How to write batch file for sqlplus
Moderator: DosItHelp
How to write batch file for sqlplus
Dear All,
I have tried to make dos batch file for sqlplus program.
sqlplus / as sysdba;
update
UPDATE
MyTable
SET MyColumn ='Y'
WHERE MyColumn ='N';
COMMIT;
But, when I run bath file only sql prompt will appear (SQL>) rest of the command will not functionning..
I have tried to make dos batch file for sqlplus program.
sqlplus / as sysdba;
update
UPDATE
MyTable
SET MyColumn ='Y'
WHERE MyColumn ='N';
COMMIT;
But, when I run bath file only sql prompt will appear (SQL>) rest of the command will not functionning..
-
- Expert
- Posts: 976
- Joined: 15 Jun 2012 13:16
- Location: Italy, Rome
Re: How to write batch file for sqlplus
hi Indra,
you can save the sql commands in a file. For example in update.sql write...
update.sql:
then in a batch file update.cmd, you can start the sql commands file.
update.cmd:
einstein1969
you can save the sql commands in a file. For example in update.sql write...
update.sql:
Code: Select all
UPDATE MyTable SET MyColumn ='Y' WHERE MyColumn ='N';
COMMIT;
then in a batch file update.cmd, you can start the sql commands file.
update.cmd:
Code: Select all
sqlplus / as sysdba @update.sql
einstein1969
Re: How to write batch file for sqlplus
You may create a TEXT file with these lines (for example UPDATE.TXT):
... and then "execute it" this way: CMD < UPDATE.TXT
Antonio
Code: Select all
sqlplus / as sysdba;
update
UPDATE
MyTable
SET MyColumn ='Y'
WHERE MyColumn ='N';
COMMIT;
exit
... and then "execute it" this way: CMD < UPDATE.TXT
Antonio
Re: How to write batch file for sqlplus
Thank you very much both of you. It works.