| Navi |
Posted: Jul 22, 2007 10:27:58 PM |
Total Post: 60
Joined: Jun, 2007
|
Hi,
Can any one please help me in this matter.
I have created a table :-
create table Employee
(
id number,
name varchar2(10),
city varchar2(10)
);
After that i created view for Employee table :-
create view viewEmployee
as
select * from Employee where id=101;
After that i tried to drop column(city) of table Employee through view(viewEmployee).
alter view viewEmployee drop column city
*
ERROR at line 1:
ORA-00905: missing keyword
But in net I saw that a view cannot be altered if we want to alter view means we need to drop the existing view and create view according to our requirements.
But when i was studying Data Dictionary i came across that if we make any changes to view it will affect base tables, then according to that definition in Data Dictionary I should be able to drop column(city) of table(Employee) through view(viewEmployee).
******** Anyone please help me to drop column(city) of table Employee through view(viewEmployee)**********.
Regards,
Naveen
|
|
|
Jolly |
| Posted: Jul 23, 2007 02:50:21 AM | |
|
Total Post: 24
Joined: Mar, 2007
|
Hi,
You cannot use drop to drop column from view. Instead of that you have to recreate view by using create or replace view then select the columns expect column city from the base table.
Cheers
|
|
|
|
|
Dipu |
| Posted: Jul 23, 2007 07:40:36 AM | |
|
Total Post: 8
Joined: Nov, 2006
|
Hi Jolly,
I wanted only point in this juncture that is view can not be altered except to compile that view i.e. Alter view view_name compile.
Thanks.
Regards,
Diptendu
|
|
|
|
|
Jolly |
| Posted: Jul 23, 2007 08:10:56 PM | |
|
Total Post: 24
Joined: Mar, 2007
|
Hi Diptendu,
Yes your point of reason is true that is also a good solution. Only thing is you have to drop the city column from the table from where the view is created.
Cheers
|
|
|
|
|
Ramesh Joyisa |
| Posted: Aug 07, 2007 03:46:27 AM | |
|
Total Post: 246
Joined: Aug, 2007
|
Can you please give the purpose of the view, because you can not alter view like altering table. you can only recreate it with the required tables
|
|
|
|
|
| Time Zone: EDT |
Send this thread to your friend |