I need to add an surrogate key to a view
Is this possible to add a column that is a surrogate key to a view.
What about using the rownum as this surrogate key. any issues or problems to arise?
Last edited by katora; 11-29-2012 at 04:08 PM.
Row num is not a deterministic function. As in every time that you select from the query the row num value is different for every row. Given that every table should have a primary key, you should be able to find a value or set of values that are always unique. If not, then you need to think about the way in which your database was designed. If this is an aggregate query then you need to group by fewer columns.
Basically your asking the wrong question. The right question should be why can't I uniquely identify each row based on a unique set of values.
this space intentionally left blank
ok, thanks I understand what you are saying. I will look at the view again. thanks
Click Here to Expand Forum to Full Width