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

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
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
Sort by: OldestNewest

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: