Home » SQL & PL/SQL » SQL & PL/SQL » Batch File
Batch File [message #259764] Thu, 16 August 2007 07:17 Go to next message
hedonist123
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

sqlpluswusername/password@server

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
Littlefoot
Messages: 21823
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;
exit;

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: Fri Dec 06 17:33:09 CST 2024