MySQL Forums
Forum List  »  Newbie

My first SQL script
Posted by: S B
Date: December 01, 2016 11:21AM

Hello all,

I am trying to create a loop, which imports CSV files into a table.
I tried the following script:


CREATE PROCEDURE import_data()
BEGIN
DECLARE v1 INT DEFAULT 1;

WHILE v1 < 151 DO
LOAD DATA INFILE 'W:/a/' + v1 + '.csv'
INTO TABLE test_table
FIELDS TERMINATED BY ','
SET v1 = v1 + 1;
END WHILE
END;


Could you help me find the mistake?
I always get

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 3

Thanks in advance

Options: ReplyQuote


Subject
Written By
Posted
My first SQL script
S B
December 01, 2016 11:21AM
December 01, 2016 11:42AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.