简体   繁体   English

获取oracle db中最后插入记录的ID

[英]Get ID of last inserted record in oracle db

I want to retrieve the id of a newly inserted record with an auto incrementing id column (using the sequence and trigger method). 我想检索具有自动递增id列的新插入记录的id(使用序列和触发器方法)。 What is the standard way to do this? 这样做的标准方法是什么?

Use the PL/SQL RETURNING clause: 使用PL / SQL RETURNING子句:

insert into mytable (...) values (...)
returning id into v_id;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM