Q

Unable to alter view

I've created a view called 'CONTACT.' But later, I need to alter the CONTACT view to 'with read only.' I try to alter it with the ALTER command, but it doesn't work. Do you have any idea what's wrong?

I've created a view called 'CONTACT.' But later, I need to alter the CONTACT view to 'with read only.' I try to alter it with the ALTER command, but it doesn't work. Do you have any idea what's wrong? Thanks for your help in advance.
SQL> create view contact
  2  as select contact, name, phone
  3  from publisher;

View created.

SQL> alter view contact (contact, name, phone
  2  as select contact, name, phone
  3  from publisher
  4  with read only;

alter view contact (contact, name, phone)
                   *
ERROR at line 1:
ORA-00922: missing or invalid option
The view you are trying to create is by default read only -- "with read only" is invalid and to alter a view use "compile or replace view <view name>." You cannot update a view. You can update the underlying tables by using an instead-of trigger.
This was first published in November 2006

Dig deeper on Using Oracle PL-SQL

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide

SearchDataCenter

SearchContentManagement

SearchFinancialApplications

Close