Updating oracle views rvsp dating
For example, suppose all the employee working in Department No.
Instead of giving this join query again and again, we can create a view on these table by using a CREATE VIEW command given below create view emp_det as select e.empno, e.ename,e.sal,e.deptno,d.dname,from emp e, dept d where e.deptno=d.deptno; Now to see the employee details and department names we don’t have to give a join query, we can just type the following simple query.
Whatever DML operations you performed on a view they actually affect the base table of the view. You can Query, Insert, Update and delete from views, just as any other table.
A view derives its data from the tables on which it is based. Views can be based on actual tables or another view also.
However, now you realize that you must redefine the ACCOUNTS_STAFF view to correct the department number specified in the WHERE clause of the defining query, because it should have been 30.
To preserve the grants of object privileges that you have made, you can replace the current version of the ACCOUNTS_STAFF view with the following statement: CREATE OR REPLACE VIEW Accounts_staff AS SELECT Empno, Ename, Deptno FROM Emp WHERE Deptno = 30 WITH CHECK OPTION CONSTRAINT ica_Accounts_cnst; Replacing a view has the following effects: With some restrictions, rows can be inserted into, updated in, or deleted from a base table using a view.