mysql 迁移到 oracle后mybatis 不支持多条语句同时执行错误信息 ORA-00911: 无效字符

之前项目mysql mybatis delete为:(mysql连接中添加allowMultiQueries=true)

<delete id="xxx" parameterType="map">
        delete from A where USER_ID = #{userId};
        delete from B where USER_ID = #{userId};
        delete from C where USER_ID = #{userId};
        delete from D where USER_ID = #{userId};
delete>

ORA-00911: 无效字符,其实提示的是第一条sql语句的分号是无效字符,因为oracle把begin end 之间的作为一条SQL来执行。

现在oracle mybatis delete 中添加 begin end

<delete id="xxx" parameterType="map">
        begin
	        delete from A where USER_ID = #{userId};
	        delete from B where USER_ID = #{userId};
	        delete from C where USER_ID = #{userId};
	        delete from D where USER_ID = #{userId};
        end;
delete>

你可能感兴趣的:(java)