Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete a column from a view

I'm trying to delete a column from a view but can't seem to be able to do it because apparently is missing a keyword. Can someone tell me what I'm missing?

ALTER VIEW REORDERINFO DROP COLUMN name;

After trying again I got the following:

SQL> ALTER VIEW REORDERINFO
AS SELECT isbn,title, phone
FROM books JOIN publisher USING (pubid);

ERROR at line 2: ORA-00922: missing or invalid option

like image 993
Anthony Avatar asked Sep 30 '12 10:09

Anthony


1 Answers

You cannot use ALTER VIEW for removing a column. To recreate the view without the column, use CREATE OR REPLACE VIEW.

From the Oracle documentation:

Use the ALTER VIEW statement to explicitly recompile a view that is invalid or to modify view constraints.

enter image description here

Source: Oracle® Database
SQL Language Reference
11g Release 2 (11.2)
E26088-01

like image 139
hol Avatar answered Oct 12 '22 22:10

hol