Primary Key on a View While answering this question
https://stackoverflow.com/questions/4668146/how-to-add-a-primary-key-on-a-oracle-view/8558346#8558346
 
A lot of questions popped in my mind. 

1. Is it advisable to have primary key in a view. 
2. Why anybody be intrested in having a primary key in a view, what are its advantages. I mean one cannot search a view by index. 
3. Is it because of hibernate, but again i have used distinct keyword in a view declaration which means i cannot insert via view.


Here is my code for view

CREATE OR REPLACE FORCE VIEW VU_NAME 
    ( 
      PRIMARY_KEY, NAME_ID, ADDRESS_ID 
     ) 
    AS  
    SELECT DISTINCT ROWNUM AS PRIMARY_KEY, 
        NAME.ID UNIT_ID, 
        ADDRESS_ID 
    from table1;
Your code creates a column with the name PRIMARY_KEY, but this is not the same as a primary key constraint. (It is not enough to be unique.) As Branko Dimitrijevic pointed out only logical constraints can be defined on views, and a primary key constraint will be enforced by Oracle.

On a materialized view where you store your data physically in the database a index may help you to find your data faster. A primary key constraint may be helpful if you want to use replication. But a materialized view is more of a table than a view.

I hope this helps to answer your questions.