Oracle是否等效于SCOPE_IDENTITY()? [英] Oracle equivalent to SCOPE_IDENTITY()?

查看:291
本文介绍了Oracle是否等效于SCOPE_IDENTITY()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以在这里验证我的想法吗?此代码是否返回我的语句插入的正确序列号:

Can some one verify my thinking here? Does this code return the correct Sequence Number as Inserted by my statement:

INSERT (myTablePrimaryKey, Field1, Field2)
VALUES (myTableSeqNo.NextVal, 'Data1', 'Data2')

Select myTableSeqNo.currval



这会返回我插入到表中的序列号吗?是否可以保证它在有许多用户和插入内容的繁忙环境中属于我?

谢谢.



Does this return the sequence number I inserted to the table and is it guaranteed to be mine in a busy environment with many users and inserts?

Thanks.

推荐答案

是的,因为oracle按会话记录了周期.除非有人同时使用您的会话.会一样.
Yes it does, as oracle records the currval by session. Unless someone is using your session at the same time. It will be the same.


这篇关于Oracle是否等效于SCOPE_IDENTITY()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆