Why does this statement work fine in workbench but not in Java.
SET @sqlstmt := IF( @exist <= 0, 'select ''INFO: Key does not exist.''', 'ALTER TABLE `SOMETABLE` DROP FOREIGN KEY `SOMEKEY`');
In Java I get
MySQLSyntaxErrorException: 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 'SET @sqlstmt := IF( @exist <= 0, 'select ''INFO: Key does not exist.''', 'ALTER ' at line 1
asked Jun 24, 2014 at 15:07
ademartini
1,4511 gold badge16 silver badges24 bronze badges
1 Answer 1
It turned out to be the fact that multiple statements were being executed (separated by semicolons). In JDBC MYSQL you need allowMultiQueries=true
answered Jun 24, 2014 at 17:51
ademartini
1,4511 gold badge16 silver badges24 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
default
"instead of two single quotes?