Use view based on user-defind type : Create View « View « Oracle PL/SQL Tutorial






SQL> create type addressType as object
  2  (Street  VARCHAR2(50),
  3   City    VARCHAR2(25),
  4   State   CHAR(2),
  5   Zip     NUMBER);
  6  /
SQL> create type personType as object
  2  (Name     VARCHAR2(25),
  3   Address  addressType);
  4  /
SQL>
SQL>
SQL> create table emp
  2  (cid NUMBER   primary key,
  3   Name        VARCHAR2(25),
  4   Street      VARCHAR2(50),
  5   City        VARCHAR2(25),
  6   State       CHAR(2),
  7   Zip         NUMBER);
SQL>
SQL> create view empView (cid, Person) as
  2  select cid,personType(Name,addressType(Street, City, State, Zip))
  3    from emp;
SQL>
SQL> drop view empView;
SQL> drop table emp;
SQL>
SQL> drop type personType;
SQL>
SQL> drop type addressType;
SQL>
SQL>








8.1.Create View
8.1.1.Views
8.1.2.Creating and Using a View
8.1.3.Creating and Using Simple Views
8.1.4.Choose specific column from base table
8.1.5.Creating a View with a CHECK OPTION Constraint
8.1.6.Creating a View with a READ ONLY Constraint
8.1.7.Create view based on user-defined function
8.1.8.Create a view by joining two tables
8.1.9.Create view based on aggregate function
8.1.10.a user-defined type view
8.1.11.CREATE MATERIALIZED VIEW with TABLESPACE
8.1.12.CREATE MATERIALIZED VIEW with rowid
8.1.13.Create view by join three tables
8.1.14.Create view on single field of a type
8.1.15.create materialized view emp_dept build immediate refresh on demand enable query rewrite
8.1.16.Use view based on user-defind type