你好.我想请问一下如何在MyBatis中获取Oracle中自动增长的主键

2025-02-25 07:30:43
推荐回答(1个)
回答1:

我们项目组正好用到了这个,SEQ_ZONE为sequence,则mybatis配置文件如下:

  
    
      SELECT SEQ_ZONE.CURRVAL AS id from dual
    
    insert into TBL_ZONE (ID, NAME
      )
    values (SEQ_ZONE.NEXTVAL, #{name,jdbcType=VARCHAR}
      )