I have an application using MyBatis, and I'm trying to add a select SQL that has multiple statements.
<select id="getReleaseDetails" resultType="maingrid" statementType="STATEMENT">
DROP TEMPORARY TABLE IF EXISTS vrTmp;
DROP TEMPORARY TABLE IF EXISTS vrTmp2;
CREATE TEMPORARY TABLE vrTmp AS (
SELECT vr.*, v.Code
...etc.
However, I keep getting the error:
Cause: com.mysql.jdbc.exceptions.jdbc4.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 'DROP TEMPORARY TABLE IF EXISTS vrTmp2;
CREATE TEMPORARY TABLE vrTmp AS (
S' at line 2
]
2014-03-11 12:48:20,069 [bio-8080-exec-3] DEBUG DataSourceUtils - Returning JDBC Connection to DataSource
2014-03-11 12:48:20,085 [bio-8080-exec-3] ERROR VRMService - Error in getDetails :
### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.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 'DROP TEMPORARY TABLE IF EXISTS vrTmp2;
CREATE TEMPORARY TABLE vrTmp AS (
S' at line 2
The error may exist in mappings/mapping.xml
The SQL works fine in SQLYog, using the same database login.
What am I missing? It's almost like it does not like the ";" to separate the individual statements.
Thanks