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 are the types of subqueries?

769


What are all the different normalization?

744


Can a varchar be a primary key?

699


Is sql similar to python?

717


What is insert command in sql?

778






What is out parameter used for eventhough return statement can also be used in pl/sql?

800


What are types of indexes in sql?

747


How do you remove duplicates without using distinct in sql?

695


what are null values? : Sql dba

708


how can we transpose a table using sql (changing rows to column or vice-versa) ? : Sql dba

692


How is a PL/SQL code compiled?

871


What is the use of count (*) in sql?

754


How do you go back in sql?

701


What is the location of pre_defined_functions.

841


define join and explain different type of joins? : Sql dba

736