tags:

views:

381

answers:

3

I understand that database views are read-only, or at least read-only by default.

Is it possible to enable the change of data brought by an oracle view?

Rephrasing: If I make a view of just one table, just to hide some columns, will changes to this data be updated on the table?

+1  A: 

I don't believe Oracle views are read only by default... a single table view should be updateable providing it doesn't contain multiple row operations like DISTINCT or GROUP BY. The user in question must have been granted UPDATE VIEW privs.

A simple view with columns removed should definitely be updatable proividing you have privs to update the view in question...

GRANT UPDATE ON your_view_name TO your_user;

What error(s) are you getting when you try to run the UPDATE statement?

cagcowboy
Sorry, this question is from a friend of mine. He's taking a college course on DB's. I told him to join this site so he could get help.
lamcro
+5  A: 

Yes, Oracle views can be modified.

There are, however, some restrictions:

andri
A: 

Hi,

In oracle a view contains no base data of it's own. So if your view allows updates then the underlying table will be updated.

If you need more information it is worth looking at the "views" section in the Oracle concepts guide.

http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/schema.htm#sthref787

Further information can also be found in the "Create View" sql command.

http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_8004.htm#SQLRF01504

Hope this helps

Regards

carpenteri