Reputation: 11
The following query does the Job: LOAD DATA LOCAL INFILE 'C:/x/y.csv' INTO TABLE test FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n' IGNORE 1 ROWS;
But i want to achieve the same by using a Stored procedure. Have come across various discussions where it is mentioned that "Load Data" cannot be used in a Stored procedure, but i couldn't find an alternate option to do this.
Can some one please provide other alternatives which can be used to load data from CSV to Mysql table using a stored procedure. Thanks in advance!
Upvotes: 0
Views: 4788
Reputation: 786
You can create a external script that does the LOAD DATA, then in the stored procedure use sys_exec to execute that command.
Upvotes: 0