Regular Views
A regular view, or more commonly referred to as a view, is not allocated any storage; only its
definition, a query, is stored in the data dictionary. The tables in the query underlying the view
are called base tables; each base table in a view can be further defined as a view.
The advantages of a view are many. Views hide data complexity—a senior analyst can define
a view containing the EMPLOYEE, DEPARTMENT, and SALARY tables to make it easier for upper
management to retrieve information about employee salaries by using a select statement against
what appears to be a table but is actually a view containing a query that joins the EMPLOYEE,
DEPARTMENT, and SALARY tables.
Views can also be used to enforce security. A view on the EMPLOYEE table called EMP_INFO
may contain all columns except for salary, and the view can be defined as read only to prevent
updates to the table:
create view EMP_INFO as
select Employee_Number, Last_Name,
First_Name, Middle_Initial, Surname
from EMPLOYEE
with READ ONLY;
Without the read only clause, it is possible to update or add rows to a view, even to a view
containing multiple tables. There are some constructs in a view that prevent it from being
updatable, such as having a distinct operator, an aggregate function, or a group by clause.
When Oracle processes a query containing a view, it substitutes the underlying query
definition in the user’s select statement and processes the resulting query as if the view did not
exist. As a result, the benefits of any existing indexes on the base tables are not lost when a view
is used.
Jumat, 12 Maret 2010
Regular Views In oracle
Label: Regular Views In oracle
Diposting oleh saeful uyun di 18.15
Langganan:
Posting Komentar (Atom)
0 komentar:
Posting Komentar