I'm hoping that someone else has run into this issue before. The trouble I am having is that I am getting the following error for my Update statement:
#42000You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"UPDATE my_table SET MY_COLUMN = '' WHERE MY_OTHER_COLUMN = 'my_value'"' at line 1 at mysql_connect.pl line 24.
I have verified that the same statement executes successfully using the MySQL CLI, so I'm not sure what syntax Perl is finding objectionable...
And now the code (you will note the Select statement that comes prior to the Update statement, which is not throwing any errors):
Thanks for any help you can provide, and please let me know if I have forgotten to include anything relevant.my $mysql = Net::MySQL->new( hostname => 'localhost', database => 'my_DB', user => 'root', password => 'my_password' ); $mysql->query(q{"SELECT * FROM my_table WHERE MY_OTHER_COLUMN LIKE 'my +_value'"}); $mysql->query(q{"UPDATE my_table SET MY_COLUMN = '' WHERE MY_OTHER_COL +UMN = 'my_value'"}); die $mysql->get_error_message if $mysql->is_error;
In reply to MySQL "Update" statement is failing with syntax error by carpediem
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |