Batch File Calling .SQL File With Parameters
850978Apr 4 2011 — edited Apr 4 2011Hello All:
I might / might not have code correct, as I can't find a Google result to answer the question and can't test this solution until it goes live, so I want to make sure I have it correct.
I have a batch file (file1.bat) that sets up some variables. Inside this file, I am calling a .sql procedure like this:
sqlplus username/password@environment @c:\sql\export.sql %cID% %sID% %exportFilename%
How do I utilize those parameters inside export.sql so they are passed to the oracle procedure?
I am currently using the following code:
BEGIN
sinterface.export(&1, &2, &3);
EXCEPTION
WHEN OTHERS
THEN NULL;
END;
Will this code work? I know if I call another .bat file from the file1.bat code, I can get the parameters such as:
SET cID = %1
SET sID = %2
SET exportFileName = %3
OR
SET CompID = %compID%
SET SiteID = %siteID%
SET exportFileName = %exportFilename%
But I have no idea if / how this translates to an oracle .sql file to call a stored procedure. I got one Google result to show using &1, &2, &3 to set the parameters from the batch file, but as I can't test this, I really have no idea if this would work.
Would anyone be able to confirm the correct method?
Thanks
Andy