How to obtain last insert id in Oracle using MyBatis?

后端 未结 4 1742
暗喜
暗喜 2020-12-16 07:01

I\'m inserting some data into an Oracle table and need to retrieve the id of the inserted row. Said id is being generated by a sequenc

4条回答
  •  庸人自扰
    2020-12-16 07:22

    Let's say the trigger uses id_seq Oracle sequence to get the id. If you execute from MyBatis using the same database session, the SQL

    select id_seq.currval from dual;
    

    You will get the ID used.

提交回复
热议问题