0

Hi,

I am writing a MySQL script. I used a parameter file to set a user variable

set @log_file = "C:/logs/table_creation.txt";

I used the variable in another file in the tee command as follows

set @log = concat("tee ", @log_file);
prepare stmt from @log;
execute stmt;

But it throws the following 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 'tee C:/logs/table_creation.txt' at line 1
ERROR 1243 (HY000): Unknown prepared statement handler (stmnt) given to EXECUTE

I used to set variables in Oracle and use it for the entire session. I am trying to do a similar thing in MySQL. Could someone help me please.

Thanks
Shiny

4
Contributors
6
Replies
7
Views
6 Years
Discussion Span
Last Post by cheelee
0

try this

SET @LOG = CONCAT('tee ', @log_file);

Please read more here.

it seems tee is a string not a function name .

Edited by debasisdas: n/a

0

Hi,

Thanks for the response. But I got the same error again. Is there any other way to pass my log file dir from a parameter file?

Shiny

Edited by shinysherbina: n/a

0

Hi,

I'm using the following code:

Parameter file

set @log_dir = "C:/logs/table_creation.txt";

Main file

set @log = concat('tee ', @log_dir);

prepare stmt from @log;
execute stmt;

Error Message

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 'tee C
:/logs/table_creation.txt' at line 1
ERROR 1243 (HY000): Unknown prepared statement handler (stmt) given to EXECUTE

Edited by shinysherbina: n/a

0

To my knowledge there is no tee statement in mysql server. You have to process the log file from the OS level or use the mysql command line client which knows how to tee.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.