August 6th, 2012, 04:22 AM
Loading files automation using Load_data
I want to load more than 100 CSV files in every week to database. For the same i am using LOAD DATA functionality of MYSQL.
To automate it. I am extracting file name & related path in csv file using scripting & loading to the table. Now i have all csv files names & path in my database table.
I tried to create a prepared statement for LOAD DATA, where i was concatenating file name & file path to LOAD DATA statement in procedure using cursor to dynamically execute it.
But here LOAD DATA is not allowed in procedures.
Can anyone please help me to do so????
Thanking you in advance.
August 6th, 2012, 07:28 AM
Don't use a stored procedure, write it in an script language outside MySQL instead that sends the LOAD DATA statements into the mysql server instead.
August 6th, 2012, 07:51 AM
Thanking you for your reply. My next question is can we use Load data in prepared statement. If not then please suggest alternative.