Updating table through view in oracle
Selector .selector_input_interaction .selector_input. Selector .selector_input_interaction .selector_spinner. CREATE VIEW sup_orders AS SELECT suppliers.supplier_id, orders.quantity, orders.price FROM suppliers INNER JOIN orders ON suppliers.supplier_id = orders.supplier_id WHERE suppliers.supplier_name = 'Microsoft'; CREATE or REPLACE VIEW sup_orders AS SELECT suppliers.supplier_id, orders.quantity, orders.price FROM suppliers INNER JOIN orders ON suppliers.supplier_id = orders.supplier_id WHERE suppliers.supplier_name = 'Apple'; A VIEW in Oracle is created by joining one or more tables.When you update record(s) in a VIEW, it updates the records in the underlying tables that make up the View.
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.
Views are very powerful and handy since they can be treated just like any other table but do not occupy the space of a table.
The following sections explain how to create, replace, and drop views using SQL commands. To see the empno, ename, sal, deptno, department name and location we have to give a join query like this.
On recompiling the dependent objects become invalid.
ALTER VIEW View-Name COMPILE ; Use Drop View statement to drop a view. Insert, Delete and Update on Views When you update a view oracle will update the underlying base table.
I don't believe Oracle views are read only by default...