mybatis 操作存储过程 小细节错误

2021-08-27 10:51:30 浏览数 (2)

项目开发的时候遇到一个错误:

代码语言:javascript复制
org.springframework.jdbc.BadSqlGrammarException: 
### Error querying database.  Cause: java.sql.SQLException: ORA-06550: 第 8 行, 第 4 列: 
PLS-00103: 出现符号 ";"在需要下列之一时:
 . ( ) , * @ % & = -   < / >
   at in is mod remainder not rem => 
   <> or != or ~= >= <= <> and or like like2 like4 likec between
   || indicator multiset member submultiset
符号 ")" 被替换为 ";" 后继续。

### The error may exist in file [D:Program FilesWorkspacesMyEclipse for Spring 2014salesmanb2bWebRootWEB-INFclassessqlmapProductMapper.xml]
### The error may involve com.salesmanb2b.mapper.ProductMapper.getProductsProc-Inline
### The error occurred while setting parameters
### SQL: {call GET_PRODUCTS   (    ?,    ?,    ?,    ?,    ?    }
### Cause: java.sql.SQLException: ORA-06550: 第 8 行, 第 4 列: 
PLS-00103: 出现符号 ";"在需要下列之一时:
 . ( ) , * @ % & = -   < / >
   at in is mod remainder not rem => 
   <> or != or ~= >= <= <> and or like like2 like4 likec between
   || indicator multiset member submultiset
符号 ")" 被替换为 ";" 后继续。

; bad SQL grammar []; nested exception is java.sql.SQLException: ORA-06550: 第 8 行, 第 4 列: 
PLS-00103: 出现符号 ";"在需要下列之一时:
 . ( ) , * @ % & = -   < / >
   at in is mod remainder not rem => 
   <> or != or ~= >= <= <> and or like like2 like4 likec between
   || indicator multiset member submultiset
符号 ")" 被替换为 ";" 后继续。

原来是映射文件出错

代码语言:javascript复制
        {call GET_PRODUCTS
        (
         #{proid,jdbcType=INTEGER, mode=IN},
         #{product1,javaType=ResultSet,jdbcType=CURSOR,resultMap=product,mode=OUT},
         #{product2,javaType=ResultSet,jdbcType=CURSOR,resultMap=product,mode=OUT},
         #{product3,javaType=ResultSet,jdbcType=CURSOR,resultMap=product,mode=OUT},
         #{product4,javaType=ResultSet,jdbcType=CURSOR,resultMap=product,mode=OUT}
         )
         }  

call后面 右括号  忘了写

这是一个小细节

PS:

对于Oracle存储过程

建议 用navicat 编写好之后运行 成功再去编写代码

0 人点赞