I have a SQL file that updates certain table. However, the table name depend on the machine name on which the software is installed. (Something like: TableFooBar-MyMachine). I have to write a batch file that calls an Oracle SQL script which will update this table.
So, BatchFile --> Update. Sql --> TableFooBar-MyMachine
The Update. Sql will have statement like:
Update TableFooBar-<Machine-Name> where fooid = -99;
This batch file needs to run on many machines. There are actually many update statements on such tables. I do not want people to edit the sql files. Instead if I set the machine name in the batch file and pass it to the sql, I'm pretty much done! How do I pass the machine name parameter to the .sql file to achieve this?
Yes, you can do this, by creating the SQL file from the BATCH file.
It would look like this:
you can use substitution variables
update.sql
and then call