Unique key on a view in Oracle

300 Views Asked by At

I have a view that does not have a unique key (It has a composite key though). I want to create a single numeric key on the fly such that it is consistent across multiple retrievals. ROWNUM is obviously not an option since it can be reassigned when data is inserted/deleted from the view. I do have the option of switching to a materialized view, but not to a lookup based load process (time constraints). Is there a way of creating a dynamic unique key in an oracle inline or materialized view that is consistent?

1

There are 1 best solutions below

0
turboc On

try create or replace someview as select col1||col2 as ukey,col1,col2,col3,col4,etc,etc,etc from sometable where whatever

this is where col1 and col2 are the combination key you said you had.