1
Oracle存儲過程:如何配置遊標的MyBatis映射器作爲輸出參數?
create or replace PROCEDURE "TGT_MPD_PLANOGRAM_SEL_SP" (
POG_NUM_IN IN VARCHAR2,
PLAN_DATA_SEL_CUR OUT SYS_REFCURSOR,
SQL_CODE_OUT OUT NUMBER,
SQL_ERR_MSG_OUT OUT VARCHAR2)
AS
...
Mapper.xml
<select id="getPlanograms" statementType="CALLABLE"
parameterType="com.tgt.snp.pog.vo.PlanogramSearchVO"
resultMap="mapResultPlanogram">
{
CALL TGT_MPD_PLANOGRAM_SEL_SP(
#{POG_NUM_IN,javaType=String,jdbcType=VARCHAR,jdbcTypeName=VARCHAR2,mode=IN},
#{PLAN_DATA_SEL_CUR,jdbcType=CURSOR,resultMap=mapResultPlanogram,mode=OUT},
#{SQL_CODE_OUT,javaType=Integer,jdbcType=INTEGER,jdbcTypeName=INTEGER,mode=OUT},
#{SQL_ERR_MSG_OUT,javaType=String,jdbcType=VARCHAR,jdbcTypeName=VARCHAR2,mode=OUT}
)
}
</select>
VO對象
public class PlanogramSearchVO {
public PlanogramSearchVO(){}
public String getPOG_NUM_IN() {
return POG_NUM_IN;
}
public void setPOG_NUM_IN(String POG_NUM_IN) {
this.POG_NUM_IN = POG_NUM_IN;
}
private String POG_NUM_IN;
public ResultSet getPLAN_DATA_SEL_CUR() {
return PLAN_DATA_SEL_CUR;
}
public void setPLAN_DATA_SEL_CUR(ResultSet PLAN_DATA_SEL_CUR) {
this.PLAN_DATA_SEL_CUR = PLAN_DATA_SEL_CUR;
}
private ResultSet PLAN_DATA_SEL_CUR;
public Integer getSQL_CODE_OUT() {
return SQL_CODE_OUT;
}
public void setSQL_CODE_OUT(Integer SQL_CODE_OUT) {
this.SQL_CODE_OUT = SQL_CODE_OUT;
}
private Integer SQL_CODE_OUT;
public String getSQL_ERR_MSG_OUT() {
return SQL_ERR_MSG_OUT;
}
public void setSQL_ERR_MSG_OUT(String SQL_ERR_MSG_OUT) {
this.SQL_ERR_MSG_OUT = SQL_ERR_MSG_OUT;
}
private String SQL_ERR_MSG_OUT;
}
錯誤消息
Caused by: org.springframework.jdbc.UncategorizedSQLException:
### Error querying database. Cause: java.sql.SQLException: Non supported SQL92 token at position: 1:
### The error may exist in class path resource [PlanogramMapper.xml]
### The error may involve com.tgt.snp.pog.mapper.PlanogramMapper.getPlanograms-Inline
### The error occurred while setting parameters
### SQL: { ?, ?, ? = CALL TGT_MPD_PLANOGRAM_SEL_SP( ? ) }
### Cause: java.sql.SQLException: Non supported SQL92 token at position: 1:
; uncategorized SQLException for SQL []; SQL state [99999]; error code [17034]; Non supported SQL92 token at position: 1: ; nested exception is java.sql.SQLException: Non supported SQL92 token at position: 1:
請幫忙指出什麼迪我錯了嗎?提前致謝。