Home » SQL & PL/SQL » SQL & PL/SQL » Batch File
Batch File [message #259764] Thu, 16 August 2007 07:17 Go to next message
Messages: 119
Registered: August 2007
Senior Member
Hi guys,

I wish to create a batch file to carry out some commands.

I have been able to open sql plus using


however, if i simply add for e.g.

select table_name from user_tables;

it doesnt execute.

Is there a particular format in which I have to write the code in a batch file so that as soon as I double click the file, the whole code that I have written executes and I can view the output on the SQL plus screen?

How about a situation when you are writing several packages? Can u include for instance two or three packages in one batch file?

Thanks a lot..
Re: Batch File [message #259766 is a reply to message #259764] Thu, 16 August 2007 07:23 Go to previous message
Messages: 21128
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Put SQL code into a file (for example, test.sql)
select table_name from user_tables;

Write DOS batch script (let's call it 'test.bat'), such as this one:
sqlplus -s scott/tiger@ora10 @test.sql

At the DOS prompt, you'd run it as
c:\> test
or create a desktop icon to start it by double-click.
Previous Topic: DBMS_LOB problem
Next Topic: row level
Goto Forum:

Current Time: Mon Jul 24 04:00:18 CDT 2017

Total time taken to generate the page: 0.12028 seconds