0

I need to execute a query multiple times with different variables and redirect the output into an output file defined in a variable.

I am trying something like

SET @OUTFILE = '/tmp/outfile_1';
select  *
from db
INTO OUTFILE @OUTFILE;

but I have the error

ERROR 1064 (42000): 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 '@OUTFILE'

Any idea how to resolve this issue?

3
  • Possible duplicate of stackoverflow.com/questions/13548118/… Commented Nov 23, 2016 at 9:58
  • In my environment it would be too much complicated to modify all the queries in the way explained in your link. I am wondering if someone has an idea on how to adapt my code (if it is possible!) @N00bPr0grammer Commented Nov 23, 2016 at 10:03
  • What you need to do is what is illustrated @AlessandroBlasetti! Commented Nov 23, 2016 at 10:27

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.