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 last published in November 2006

Dig Deeper on Using Oracle PL-SQL

PRO+

Content

Find more PRO+ content and other member only offers, here.

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.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide

SearchDataCenter

SearchContentManagement

SearchFinancialApplications

Close