关注JEECG发展历程 关注最新动态和版本, 记录JEECG成长点滴 更新日志 - 技术支持 - 招聘英才

JEECG最新版本下载 JEECG智能开发平台 - 显著提高开发效率 常见问题 - 入门视频 - 参与开源团队

商务QQ: 69893005、418799587 商务热线(5*8小时): 010-64808099 官方邮箱: jeecgos@163.com

查看: 12926|回复: 1

3.0用oracle执行多条sql报错,请支持

[复制链接]
发表于 2021-11-19 08:01:34 | 显示全部楼层 |阅读模式
mapper.xml 中写法:
<!-- 彻底删除机构,同时删除其对应的所有相关的数据 -->
        <delete id="deleteDepart">
          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;
        </delete>


报错信息:
==>  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:

   ; <an identifier> <a double-quoted delimited-identifier>
The symbol ";" was substituted for "end-of-file" to continue.


看错误信息是最后end后面没有;结束,但源码上明明有中,请大家分析一下。
 楼主| 发表于 2021-11-19 10:07:52 | 显示全部楼层
改为存储过程一样不行,报错如下:
### 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)
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表