带有链接SQL查询的JdbcTemplate?

时间:2019-03-07 12:33:38

标签: java spring spring-jdbc

如何将多个sql语句链接到一个sql中? 因为我想外部化一堆应该通过一个jdbctemplate调用执行的sql语句。因此,我试图将它们链接到一条更新语句中:

jdbcTemplate.update("DROP TABLE IF EXISTS mytable; CREATE TABLE mytable like source_table;");

结果:

Caused by: java.sql.SQLException: 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 'CREATE TABLE mytable like source_table;' at line 1

0 个答案:

没有答案