Mybatis执行多条SQL(Mysql、Oracle)

Mybatis执行多条SQL(Mysql、Oracle)
Mysql:
数据连接开启多条语句处理
在url后面加入allowMultiQueries=true
例:

url: jdbc:mysql://127.0.0.1:3306/user?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&allowMultiQueries=true`

//每条sql以分号结束
 
 	delete from table1 where id = 1;
 	delete from table2 where id = 2;
 

Oracle:

//每条sql以分号结束,end也是分号结束

	begin
	delete from table1 where id = 1;
 	delete from table2 where id = 2;
 	end;



你可能感兴趣的:(数据库)