a. Can you delete data from a View.
b. If Yes, can you delete it if there are multiple tables
c. If No, can you delete if there is single source table
which is joining.

Answer Posted / suman

Yes we can insert records if view having one to one table. but we cannot create insert if we have multiple table join query

create or replace view v_emp
as select * from emp;

insert into v_emp(empno,ename,job,mgr,hiredate,sal,comm,deptno)
values(1111,'suman','CLERK',1111,SYSDATE,11,1,20);

create or replace view v_emp
as select empno,ENAME,job,deptno from emp;

insert into v_emp(empno,ename,job,deptno)
values(1112,'suman','CLERK',20);



SELECT * FROM V_EMP WHERE EMPNO=1111;
SELECT * FROM V_EMP WHERE EMPNO=1112;

create or replace view v_emp_dept
as select empno,e.deptno,dname from emp e, dept b where e.deptno=b.deptno;

insert into v_emp_dept(empno,deptno,dname)
values(1112,'suman','CLERK');

select * from v_emp_dept where empno=1111;
01776. 00000 - "cannot modify more than one base table through a join view"
*Cause: Columns belonging to more than one underlying table were either
inserted into or updated.
*Action: Phrase the statement as two or more separate statements.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is cross join sql?

506


How will you distinguish a global variable with a local variable in pl/sql?

630


How many types of functions are there in sql?

509


How much does a sql dba make? : SQL DBA

513


What is linq to sql?

557






Differentiate between % rowtype and type record.

735


What does trigger mean in psychology?

541


What is the use of non clustered index?

531


How do you create an update query?

528


How do you take the union of two tables in sql?

517


How to select the Nth maximum salary from Table Emp in Oracle SQL Plus ?

608


What will you get by the cursor attribute sql%rowcount?

555


how to convert dates to character strings? : Sql dba

539


How many types of cursors supported in pl/sql?

596


How would you reference column values before and after you have inserted and deleted triggers?

628