获取Oracle数据库中最后插入的记录的ID [英] Get ID of last inserted record in oracle db
本文介绍了获取Oracle数据库中最后插入的记录的ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用自动递增的id列(使用序列和触发器方法)来检索新插入记录的id.这样做的标准方法是什么?
I want to retrieve the id of a newly inserted record with an auto incrementing id column (using the sequence and trigger method). What is the standard way to do this?
推荐答案
使用PL/SQL RETURNING
子句:
Use the PL/SQL RETURNING
clause:
insert into mytable (...) values (...)
returning id into v_id;
这篇关于获取Oracle数据库中最后插入的记录的ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文