I am trying to import data into a table in Oracle from a CSV file using SQL Loader. However, I want to add two additional attributes namely date of upload and the file path from which the data is being imported. I can add the date using SYSDATE, Is there a similar method of obtaining the file path?
Asked
Active
Viewed 102 times
1
-
Are you calling the sql-loader executable via command line ? – Sudipta Mondal Jun 22 '18 at 04:12
-
Yes, I am Sudipta. – Shalini Guha Jun 22 '18 at 04:17
-
I don't think there is any way, the only option is to create a control file on the fly. Have a look at this answer - https://stackoverflow.com/questions/4552947/use-parameters-with-ctl – Sudipta Mondal Jun 22 '18 at 04:25
-
This is a complete example - http://www.orafaq.com/forum/mv/msg/12234/35341/#msg_35341 – Sudipta Mondal Jun 22 '18 at 04:28
1 Answers
0
The trouble with using SYSDATE is that it will not be the same for all rows. This can make it difficult if you do more than one load in a day and need to back out a particular load. Consider using a batch_id also using the method in this post: Insert rows with batch id using sqlldr I suspect it could be adapted to use the SYSDATE as well so it would be the same for all rows. Give it a try and let us know. At any rate, using a batch_id from a sequence would make working with problems much easier should you need to delete based on a batch_id.

Gary_W
- 9,933
- 1
- 22
- 40