Azeem Ullah
Azeem Ullah

Reputation: 125

How to add 'WITH READ ONLY' constraint in views in Oracle

I have created a simple view and have forgotten to add WITH READ ONLY while creating the view. Now I want to alter the view and add WITH READ ONLY option. What will be the query for it?

Upvotes: 4

Views: 16769

Answers (1)

Marmite Bomber
Marmite Bomber

Reputation: 21073

alter view x read only;

was added in 11.2, but unfortunately only for editioning views. So there is a chance that in some future version this will be extended to regular views:)

Until that use simple create or replace view

create or replace view x as 
select * from dual /* your query */
with read only;

or

create or replace view x as 
select * from dual /* your query */
with check option;

Upvotes: 8

Related Questions