Job Seekers   Employers
dbapool: Authors | Submissions | Contact Us
   Forgot password? | Sign up
  Home   Discussion Forum   Articles   Interview Questions   FAQs   Scripts   Rewards   Analyzer   White Papers   Blog   Certification   Downloads   Tools
 

Topic: SQL*Plus and PL/SQL >> Alter View.........

Disclaimer: The purpose of all dbapool forums including OCP and Other Oracle Certification forums is to help each other with specific issues but not to share dump and copyrighted exam content, materials or intellectual property. You may review the entire Oracle Certification Program Candidate Agreement online Here.



  


 Title: Alter View.........
 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

  




Forum Rules & Description


Who Can Read The Forum? Any registered user or guest
Who Can Post New Topics? Any registered user
Who Can Post Replies? Any registered user




 








Get FREE Magazines

Top 10 Forum User

  Murtuja Khokhar857
  Mohammed Taj746
  positive fanatic483
  Jayanta Sur479
  Vigyan Kaushik386
  Vinoth Kumar357
  Gopu Gopi340
  Gitesh Trivedi322
  neeraj sharma258
  Ramesh Jois246






oracle Mag



  About Us Advertise Terms of Use Privacy Newsletters Contact Us    

Home   Discussion Forum   FAQs  Articles  Jobs   Newsletters  Directory  Downloads 

Our Premium Sponsor
Confio Software