Home » RDBMS Server » Server Utilities » SQL script - Batch File
SQL script - Batch File [message #368184] Tue, 26 September 2000 08:59 Go to next message
Chella
Messages: 25
Registered: September 2000
Junior Member
I have a sql script (..\Bin\temp\test.sql) to load the data to Excel as follows;
---------------------------------------
declare
output utl_file.file_type;
begin
output := utl_file.fopen( 'c:\temp\', 'epoctrans.slk', 'w');
utl_file.fclose( output );
output := utl_file.fopen( 'c:\temp\', 'epoctrans.slk', 'w',32000);
owa_sylk.show(
p_file => output,
p_query => 'select * from scott.tblMailBoxData where CustAcNumber = :CustAcNumber',
p_parm_names =>
owa_sylk.owaSylkArray( 'CustAcNumber'),
p_parm_values =>
owa_sylk.owaSylkArray( '11318624' ),
p_show_grid => 'YES' );
utl_file.fclose( output );
end;
----------------------------------------
At the SQL prompt, I type @..\Bin\test.sql and then on the next line I have to type '/' for the script to get executed. The script works fine and produces the SLK file. Then I created a batch file (.BAT) and it contains the following code;
---------------------------------------------
D:\Orant\Bin\Plus80.exe scott/tiger@chelladb @D:\Orant\Bin\test.sql
---------------------------------------------
When I run the batch file at the Windows command prompt, it waits for the '/' to be entered, same situation as SQL prompt. Can anyone tell me how can I just let the batch file to do the execution without any user interuption and at the end, the SQL session should be closed as well. Help is really appreciated.
Re: SQL script - Batch File [message #368186 is a reply to message #368184] Tue, 26 September 2000 10:54 Go to previous messageGo to next message
Bala
Messages: 205
Registered: November 1999
Senior Member
Hi,
Add the / at the bottom of the test.sql
Thank U - SQL script - Batch File [message #368190 is a reply to message #368184] Wed, 27 September 2000 05:44 Go to previous messageGo to next message
Chella
Messages: 25
Registered: September 2000
Junior Member
Yes, I gathered that yesterday and managed to fix it. Thank U again for the help.
Re: SQL script - Batch File [message #368203 is a reply to message #368184] Fri, 29 September 2000 00:20 Go to previous message
Suneet
Messages: 3
Registered: September 2000
Junior Member
Hi,

If u want to end SQL session at the end of the batch file, create an sql file, say test1.sql with contents -

@test.sql
exit

Place this in the same directory as test.sql. and then execute this file instead of test.sql from command prompt.

Hope this helps.
Previous Topic: Datawarehouse database requirements
Next Topic: What is the order of Export and Import
Goto Forum:
  


Current Time: Sat May 21 03:25:30 CDT 2022