Re: Oracle Foreignkey: really it works?

From: <sybrandb_at_my-deja.com>
Date: Sat, 14 Oct 2000 08:02:26 GMT
Message-ID: <8s93uh$6fo$1_at_nnrp1.deja.com>


In article <nmLF5.7745$Nz.129593_at_news.infostrada.it>,   "Antonio Sant" <asant_at_iol.it> wrote:
> Excuse my bad English.
>
> I want to discuss with you this strange (?) behaviour.
>
> Suppose we have this tables
>
> Tab1
> ID NUMBER
> Flag Char(1)
> Resource Number
>
> Tab2
> Flag Char(1)
> Resource Number
> Desc Varcahr(200)
>
> with a foreing key from Tab2 to Tab1 defined as (flag,resource).
>
> If we submit this code
>
> Begin
> Insert into Tab1
> Values (1,'K',12);
>
> Insert into Tab2
> Values ('K',12,'Oracle test');
>
> END;
>
> It works great, but the same applay for the next:
>
> Begin
>
> Insert into Tab2
> ('K',NULL,'Oracle test');
>
> END;
>
> For Oracle the Foreing key relation hold!
>
> We are working with Oracle 7 version 7.4 On AIX, the same things seme
 to
> work in Oracle 8.0 on Sun!
>
> Is this a bug?
>
> Any suggestion?
>
> If needed I can post a more detailed version.
>
> Bye for now!
>
>

Officially primary keys always consist of mandatory columns only. Oracle is allowing primary keys partially null. However, from your post it is impossible to see the exact table definition.
It looks like you shouldn't blame Oracle, and you should blame your table definition as all those columns seem to be null allowed.

Regards,

--
Sybrand Bakker, Oracle DBA

All standard disclaimers apply
------------------------------------------------------------------------


Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Sat Oct 14 2000 - 10:02:26 CEST

Original text of this message