MySQL Forums
Forum List  »  Events (Job Scheduler)

PREPARE STM1 syntax error
Posted by: Jose Perez
Date: April 14, 2017 09:04AM

Hello,

I want to execute the following script:

SELECT @query := concat("SELECT * FROM test.station07 INTO OUTFILE 'c:/logs/test/", DATE_FORMAT(now(), '%Y_%M_%D'),".csv' FIELDS TERMINATED BY ',' ENCLOSED BY '""' ESCAPED BY '\\'LINES TERMINATED BY '\n'")

But I'm having trouble when I create the statement on the next lines:

PREPARE stmt1 FROM @query
EXECUTE stmt1

I keep getting this error:
Error Code: 1064. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'stmt1 FROM @myCommand

Options: ReplyQuote


Subject
Views
Written By
Posted
PREPARE STM1 syntax error
480
April 14, 2017 09:04AM
277
April 14, 2017 10:24AM
226
April 14, 2017 10:45AM
293
April 14, 2017 01:17PM
240
April 14, 2017 02:13PM


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.