Skip to content Skip to sidebar Skip to footer

Oracle View Creation With A Database Generated Id From A Sequence Object

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.

Solution 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 ....
         orderby ....)

Post a Comment for "Oracle View Creation With A Database Generated Id From A Sequence Object"