Windows batch job Help [message #359846] |
Tue, 18 November 2008 06:02  |
Srinandini
Messages: 13 Registered: November 2008
|
Junior Member |
|
|
Hi All
My requirement isto call .sql script files from a windows batch (.bat) file. The filename is given as input
The SQl scripts will have stateements to create table, alter structute etc
I have developed a sample batch job that takes a Stored procedure's name as nput and executes it
But am not able to call sql files within the .bat file
Could you please help on this?
Regards
Srinandini
|
|
|
|
|
Re: Windows batch job Help [message #359866 is a reply to message #359846] |
Tue, 18 November 2008 06:31   |
Srinandini
Messages: 13 Registered: November 2008
|
Junior Member |
|
|
@echo off
set PNAME=%1
echo Command Line Argument: %PNAME%
echo connect produser/password@cms_prd_bg01 >%0.tmp
echo set serveroutput on;>>%0.tmp
echo exec %PNAME%; >>%0.tmp
rem -- Run sql script --
sqlplus /nolog @%0.tmp
rem -- Cleanup --
del %0.tmp
goto End
:Usage
echo Usage: %0 TABLE_NAME
:End
this is the bat code. Am passing a name of the SP as input where it works fine
But i need to pass filename as input . Amexecuting the batch file from cmd prompt
I tried to place all the stmts in the SQl scripts inside the Sp.
But since i used execute immediate am facing the problem of Insufficient previleges
So can u pls help me how to go abt this?
|
|
|
Re: Windows batch job Help [message #359871 is a reply to message #359866] |
Tue, 18 November 2008 06:53   |
tahpush
Messages: 961 Registered: August 2006 Location: Stockholm/Sweden
|
Senior Member |

|
|
Dont know if I understand you correctly, but if you want to "send" the filename as an input parameter to your bat file.
set procname=%1
set filename=%2
echo connect produser/password@cms_prd_bg01 >%filename%
then just
C:\>test.bat P1 C:\>myscripts\myfile.tmp
[Updated on: Tue, 18 November 2008 06:54] Report message to a moderator
|
|
|
|
|