当前使用版本3.4.3.1

该问题是如何引起的?oracle数据库无法支持多条sql一起执行或存储过程调用

重现步骤

mapper.xml 中写法:                  BEGIN                DELETE FROM sys_user_menu t WHERE t.user_id in(select id from sys_user where depart_id=#{departId});                DELETE FROM sys_depart_role t WHERE t.depart_id=#{departId};                DELETE FROM sys_user t WHERE t.depart_id=#{departId};                DELETE FROM sys_depart t WHERE t.id=#{departId};          END;        --

报错信息

==> Preparing: BEGIN DELETE FROM sys_user_menu t WHERE t.user_id IN (SELECT id FROM sys_user WHERE depart_id = ?); DELETE FROM sys_depart_role t WHERE t.depart_id = ?; DELETE FROM sys_user t WHERE t.depart_id = ?; DELETE FROM sys_depart t WHERE t.id = ?; END ==> Parameters: ff8080816e44382f016e49ab522e031a(String), ff8080816e44382f016e49ab522e031a(String), ff8080816e44382f016e49ab522e031a(String), ff8080816e44382f016e49ab522e031a(String) 2021-11-19 07:55:04.005 [http-nio-8000-exec-1] ERROR druid.sql.Statement:149 - {conn-10004, pstmt-20012} execute error. BEGIN DELETE FROM sys_user_menu t WHERE t.user_id IN (SELECT id FROM sys_user WHERE depart_id = ?); DELETE FROM sys_depart_role t WHERE t.depart_id = ?; DELETE FROM sys_user t WHERE t.depart_id = ?; DELETE FROM sys_depart t WHERE t.id = ?; END java.sql.SQLException: ORA-06550: 第 6 行, 第 3 列: PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:

; The symbol ";" was substituted for "end-of-file" to continue.

看错误信息是最后end后面没有;结束,但源码上明明有中

改为存储过程一样不行,报错如下:### Error querying database.  Cause: com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: Failed to process, Error SQL: { call delDept(? ) }### Cause: com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: Failed to process, Error SQL: { call delDept(? ) }org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:### Error querying database.  Cause: com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: Failed to process, Error SQL: { call delDept(? ) }### Cause: com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: Failed to process, Error SQL: { call delDept(? ) }        at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:96)        at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)        at com.sun.proxy.$Proxy134.selectOne(Unknown Source)        at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:160)        at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:89)

Comment From: miemieYaho

存储过程是你用了一些mp的插件进行sql解析报错,第一个你最好用原始mybatis试了能执行再说

Comment From: wjxiongw

在别的纯mybatis 项目中是可以执行成功的。

Comment From: wjxiongw

BEGIN
DELETE FROM table t WHERE t.id=1;
END;
最简化就是这样的,在只是使用mybatis的项目中可以用,在使用mybtis-plus中不行。

Comment From: qmdx

是不是使用了插件导致,如果是排查存储过程该 mapper 方法