1

I have a View in an Oracle database. I want to use this view in my ASP.NET MVC project. I know that in order to add that view to EF, that view needs to have a primary key. 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.

jason
  • 6,962
  • 36
  • 117
  • 198

1 Answers1

1

Building on Ivan's comment, you could build your view like this:

SELECT rownum, *
  FROM (your_current_view_query)
DCookie
  • 42,630
  • 11
  • 83
  • 92
  • This approach provides a unique key, but is not determinnistic, i.e. different queries can assign different "primary keys" to one row. This is **not what is expected from a PRIMARY KEY**. – Marmite Bomber Apr 19 '17 at 16:57