2 qq 22701921 qq_22701921 于 2017.01.17 10:27 提问

mybaitis插入返回主键的时候报错,显示ORA-00923:

sql语句:

 <insert id="insert" parameterType="com.zbiti.itop.complain.entity.Complain">
        <![CDATA[
            insert into MSS_FAULT
            (mf_id,mf_Sys_Type,mf_Major,mf_Detail)
            values (SEQ_MSS_FAULT.nextval,#{mfSysType},#{mfMajor},#{mfDetail})
        ]]>

        <selectKey order="AFTER" keyProperty="mfId" resultType="java.lang.String">  

            select LAST_INSERT_ID()
        </selectKey>  
    </insert>

下面是报错:

 2017-01-17 10:19:35.935 [http-bio-8080-exec-8] DEBUG com.zbiti.base.spring.EmossExceptionHandler(133) - Resolving exception from handler [public void com.zbiti.itop.complain.controller.ComplainController.add(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) throws java.lang.Exception]: org.apache.ibatis.exceptions.PersistenceException: 
### Error updating database.  Cause: org.apache.ibatis.executor.ExecutorException: Error selecting key or setting result to parameter object. Cause: java.sql.SQLSyntaxErrorException: ORA-00923: 未找到要求的 FROM 关键字
Caused by: org.apache.ibatis.executor.ExecutorException: Error selecting key or setting result to parameter object. Cause: java.sql.SQLSyntaxErrorException: ORA-00923: 未找到要求的 FROM 关键字


set get 方法也都提供了,请问这个是怎么回事儿?谢谢

1个回答

JE_GE
JE_GE   2017.01.17 10:59
 select LAST_INSERT_ID()这个是mysql
 oracle是  SELECT SEQ_MC_MEMB.CURRVAL  AS VALUE FROM DUAL 
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!