问题
Can i create an oracle "View" with a DB generated Primary Key?
I want to create a view with its ID being a DB generated ID from a Sequence object.
回答1:
You can't do exactly that, but you can do something like this:
select rownum, field1, field2
from...
the rownum is an aoutogenerated field that holds exactly that, but it's assigned BEFORE ordering records, so if you have an ORDER BY clause, then you'll have to do this:
Select rownum, *
from (select ....
order by ....)
来源:https://stackoverflow.com/questions/9778323/oracle-view-creation-with-a-database-generated-id-from-a-sequence-object