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

Home -> Community -> Usenet -> c.d.o.server -> Why isn't table A always key-preserved if equijoined to the key of table B?

Why isn't table A always key-preserved if equijoined to the key of table B?

From: Jaap W. van Dijk <j.w.vandijk.removethis_at_hetnet.nl>
Date: Wed, 05 May 2004 20:39:15 +0200
Message-ID: <gnci90ljpaushcuvctcea69quqdhu3q9l9@4ax.com>


Hi,

It seems to me table A should always be key-preserved if equijoined to the key of table B, but Oracle seems to disagree. Example:

SQL> create table jvd_t1 (c1 number, c2 number,c3 number);

Table created.

SQL> create table jvd_t2 (d1 number, d2 number);

Table created.

SQL> alter table jvd_t2 add primary key (d1);

Table altered.
*********** the following update works: SQL> update (select t1.*,t2.*
2 from jvd_t1 t1,jvd_t2 t2
3 where c1 = d1 )
4 set c2=d2;

0 rows updated.

Why does the key-preserverdness of a table depend on the way I use the columns to equijoin to the key of another table? Oracle can conclude that for every record of jvd_t1 I will still fetch only one record (at the most) from the lookup-table, so jvd_t1 is still key-preserved.

Oracle 9.2 on Sun OS.

Jaap. Received on Wed May 05 2004 - 13:39:15 CDT

Original text of this message

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