Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: What happen to a view if a base table is updated?

Re: What happen to a view if a base table is updated?

From: Hans Forbrich <hforbric_at_yahoo.net>
Date: Sat, 17 Jan 2004 00:36:11 GMT
Message-ID: <400882F4.60291587@yahoo.net>


Tom wrote:

> Hi,
> I am beginning to learn Oracle.
> I don't understand how views work.
>
> Suppose I have a table emp(emp_no, emp_name), in witch I have:
> emp_no emp_name
> --------------------------
> 122 Andy
> 521 Tom
>
> If I do that:
> CREATE VIEW view_1 AS SELECT emp_no, emp_name FROM emp;
>
> I can do that:
> select * from view_1; I get of course;
> emp_no emp_name
> --------------------------
> 122 Andy
> 521 Tom
>
> But if some tuples in the table 'emp' are updated (suppose the emp_no
> has changed), what will happen with my request: select * from view_1;
> Will I get the same results or changes in view_1 are automatic?
> Shall I drop view_1 then create it again to get changes?

You are confusing the concept of 'snapshot' and 'view'. Easiest way of look at these:

A 'snapshot' is usually a [temporary] table whose contents will be static and will reflect the 'base table(s)' contents at time of last refresh.

A 'view' is totally dynamic. You could consider it a 'stored shorthand' for a query you wish to perform. It has no data of it's own, and will always go back to the underlying table when invoked.

/Hans Received on Fri Jan 16 2004 - 18:36:11 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US