Oracle - 具有自动增量ID的MyBatis Insert语句

时间:2017-02-02 10:25:51

标签: angularjs oracle oracle10g mybatis spring-mybatis

Oracle版:10g。

在我的Mapper.xml中

<insert id="insert" useGeneratedKeys="true">
<selectKey keyProperty="id" resultType="int" order="BEFORE">
       SELECT AUTO_INCR.nextVal from dual;
</selectKey>
INSERT INTO TABLE1(id,email,subject)
VALUES(#{id},#{email},#{subject})
</insert>

我在oracle中的表结构:

id PK NUMBER

电子邮件Varchar2

主题Varchar2

我还创建了一个名为 AUTO_INCR

的序列

但这会给我一个错误: ORA-0091无效字符

我在我的页面上通过以下方式调用它:

http.post({
     method: 'POST',
     url: 'myurl',  
     data: {
       email: email,
       subject : subject
}
})

知道如何继续吗? 我试图研究错误,但无济于事,我无法解决它。

0 个答案:

没有答案
相关问题