Materialized Views

Setup

Run the code on this page in SQL*Plus to create the sample tables, data, etc. used by the examples in this section.

Be sure to read Using SQL Snippets ™ before executing any of these setup steps.

create table t
(
  key  number       primary key
, val  varchar2(5)
) ;

insert into t values ( 1, 'a'  );
insert into t values ( 2, 'b'  );
insert into t values ( 3, 'c'  );
insert into t values ( 4, null );

commit;

create table t_backup as
  select * from t
;

create table t2
(
  key    number  primary key
, t_key  number  not null references t
, amt    number  not null
) ;

insert into t2 values ( 10, 1, 100 ) ;
insert into t2 values ( 20, 1, 300 ) ;
insert into t2 values ( 30, 1, 200 ) ;
insert into t2 values ( 40, 2, 250 ) ;
insert into t2 values ( 50, 2, 150 ) ;
commit;

create table t2_backup as
  select * from t2
;

 



Linking to SQL Snippets ™

To link to this page in Oracle Technology Network Forums or OraFAQ Forums cut and paste this code.

  • [url=http://www.sqlsnippets.com/en/topic-12870.html]SQL Snippets: Materialized Views - Setup[/url]

To link to this page in HTML documents or Blogger comments cut and paste this code.

  • <a href="http://www.sqlsnippets.com/en/topic-12870.html">SQL Snippets: Materialized Views - Setup</a>

To link to this page in other web sites use the following values.

  • Link Text : SQL Snippets: Materialized Views - Setup
  • URL (href): http://www.sqlsnippets.com/en/topic-12870.html