GeekInterview.com
Series: Subject: Topic:
Question: 44 of 133

Can a view be updated/inserted/deleted? If Yes under what conditions ?

A View can be updated/deleted/inserted if it has only one base table if the view is based on columns from one or more tables then insert, update and delete is not possible.
Asked by: Interview Candidate | Asked on: Sep 7th, 2004
Showing Answers 1 - 9 of 9 Answers
pooja

Answered On : Nov 27th, 2005

It is possible through instead of triggers

  
Login to rate this answer.
Archana Patil

Answered On : Dec 20th, 2005

View can be update/insert/delete if it contain fields of one table, and 1.primary key should contain in select clause used for view2. but again if select stmt used in view conatins group by caluse then we cant update view. 3. If select caluse contains more than one tables then we can use instead of trigger for dml operations.

  
Login to rate this answer.
CH

Answered On : Mar 24th, 2006

If a view is update, deleted , or inserted wil the changes be refelected on the base table

  
Login to rate this answer.

Can you please give me an example of this

  
Login to rate this answer.

yes possible with only simple viewpossible with compex views with instead trigger

  
Login to rate this answer.
Lavanya Chowdary

Answered On : May 6th, 2007

If the view is a simple view means if it is created based on single table with simple select statement.If the view is a complex view means if it is created based on multiple tables some times it is not possible to update complex views. We had some restrictions for the DML operations on a complex view.Whatever the updations that are not possbile with the normal DML statements that will be updated through instead of triggers.

  
Login to rate this answer.
sandeep5580

Answered On : Mar 29th, 2008

View all answers by sandeep5580

Updating a view means nothing but updating the base tables on which  that view is built.If the view id created from a single table.then it is possible to insert,update,delete through the view.Conversly,if a view is created by two or more tables,then in order to perform insert.update and delete operations through that view,we need to write insteadof trigger for insert,update and delete respectively.

  
Login to rate this answer.
venkat82.k

Answered On : Apr 9th, 2008

View all answers by venkat82.k

Hi friendsAs ur discussions we can perform dml operations on simple view ,But ,we cannot do any dmls on complex views at that time we can use instead of triggers then we can do the dmls on any views.okkkkkkkkkkkkk

  
Login to rate this answer.
ravisavaliya

Answered On : Apr 22nd, 2008

View all answers by ravisavaliya

Take an example Table : Employee(id number primary key,name varchar2(20),departmentid number)If created view in such a fashion, it includes all Not Null attribues & it does not contains group by and disctinct key word, then view is updatableUpdatab;e/insertable view : create view updatable_view_emp as select id,name from employee.Non updatable: create view nonupdatable_view_emp as select name from employee.                          create view nonupdatble_view as select id.name from employee                                           group   by departmentid;

  
Login to rate this answer.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.