获取序列名称 (Oracle)?
我无权查看数据库,但我能够创建数据库对象(通过 xml 文件)。 xml 文档说,如果我将名为“identity”的属性设置为 true,则将创建一个序列。我是否可以编写返回序列名称的逻辑,以便在编写 INSERT 语句时可以使用 nextVal?
罗伯特
这是文档,查找“身份”一词...
I don't have access to see the database, but I have the ability to create database objects (via an xml file). The xml documentation says that if I set an attribute called "identity" to true then a sequence will be created. Is it possible for me to write logic that would return the name of the sequence so that I can use nextVal when I'm writing INSERT statements?
Robert
Here's the documentation, do a find on the word "identity"...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您可以运行 select 语句,那么您也许可以尝试 select * from user_sequences 来获取序列的名称。否则,能否请您发送您正在使用的数据库创建实用程序的文档(如果它是公开的)。否则的话,这个问题就很难回答了。
编辑:
在查看文档后,它说如果您创建了一个带有主键的表,它将创建一个具有以下规则的序列,直接从文档中引用:
因此,您的查询将是:
If you can run select statements, then you might be able to try select * from user_sequences to get the names of sequences. Otherwise, could you please send the documentation for this database creation utility that you are using, if it is public. Otherwise, it will be very difficult to answer this question.
EDIT:
After a review of the documentation, it said that if you created a table with a primary key, it would create a sequence with the following rules, quoted directly from the documentation:
Thus, your query would be: