Use file name to create the table first [message #641780] |
Mon, 24 August 2015 00:59 |
|
Hi all,
I load csv file data using below script. After loading I manipulate data using @update.sql file:
sqlldr user/pass@conn control=D:\Load\My_data.ctl log=D:\Load\My_data.log
sqlplus user/pass@conn @update.sql
Now my requirement is before loading csv file data, I have to create the target table dynamically. The table name would be a fixed text and the last 7 characters of file name from which I am loading data. The columns are fixed of that table.
Please help how to get the last 7 characters of file name and pass it to sqlplus so that I can create the table first and then I will load the data in the same batch file.
|
|
|
|
|
|
|
Re: Use file name to create the table first [message #641785 is a reply to message #641782] |
Mon, 24 August 2015 01:58 |
|
Thanks All
Using below script I am very close to the solution:
for %%i in (*.csv) do (
set fName = %%i
sqlplus user/pwd@conn @ddl.sql %%i
)
sqlldr user/pwd@conn control=D:\Roche\Roche_Zyto.ctl log=D:\Roche\Roche_Zyto.log
sqlplus user/pwd@conn @update.sql
|
|
|
|