具體xml中sql是這樣寫,但是要注意SQ_USER.Nextval,SQ_USER是序列,你要替換下自己要進行操作的表的序列,不知道序列的話,可以sql查找下,select * from user_sequences查找全部序列,找到該表單序列名稱,或者模糊查詢表名select * from user_sequences where SEQUENCE_NAME LIKE '%USER%';,找到序列名稱替換SQ_USER即可
<insert id="insertSelective" parameterType="com.xx.pojo.User">
<selectKey resultType="java.math.BigDecimal" order="BEFORE" keyProperty="id">
SELECT SQ_USER.Nextval from DUAL
</selectKey>
</insert>
https://blog.csdn.net/f1370335844/article/details/82460712