Ask the Expert

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? 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

    Requires Free Membership to View

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

Join the conversationComment

Share
Comments

    Results

    Contribute to the conversation

    All fields are required. Comments will appear at the bottom of the article.