简体   繁体   English

如何向视图添加主键-Oracle

[英]How to add a primary key to a View - Oracle

I have a View in an Oracle database. 我在Oracle数据库中有一个View。 I want to use this view in my ASP.NET MVC project. 我想在我的ASP.NET MVC项目中使用此视图。 I know that in order to add that view to EF, that view needs to have a primary key. 我知道,为了将该视图添加到EF,该视图需要具有主键。 I don't know how to add a primary key as a new column to that view. 我不知道如何向该视图添加主键作为新列。 None of the columns in the view is unique. 视图中的列都不是唯一的。 How can I add that? 如何添加呢? Thanks. 谢谢。

Building on Ivan's comment, you could build your view like this: 基于Ivan的评论,您可以像这样构建视图:

SELECT rownum, *
  FROM (your_current_view_query)

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

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