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: 1:c - relation in oracle

Re: 1:c - relation in oracle

From: Rene Nyffenegger <rene.nyffenegger_at_gmx.ch>
Date: 23 Dec 2003 19:26:36 GMT
Message-ID: <bsa4tc$b5jv1$1@ID-82536.news.uni-berlin.de>

> Hi,
>
> can anybody tell me how a 1:c - relation (c is a fixed number, e.g.1:0, 1:1,
> 1:2, ..., 1:N) can be realized in Oracle?
>
> Thank you and best regards,
> Christian

Christian,

It makes me wonder what exactly you're after. That said, it is not possible (at least with Oracle) to build a say 1:3 relation between two tables, at least not in the traditional sense.

Yet, not all is lost.

Consider:

create table t_A (
  a number primary key,
  b Varchar2(20)
);

create table t_B (
  c references t_A
  d Varchar2(50)
);

Now, if you want a 1:3 relationship between t_A and t_B, then do it as follows

create table t_A1_B3 (
  a number primary,

  d1  Varchar2(50) not null,
  d2  Varchar2(50) not null,
  d3  Varchar2(50) not null

);

Then, you fill all three d's that would go into t_B into d1, d2, and d3, respectively.

hth,
Rene

-- 
  Rene Nyffenegger
  http://www.adp-gmbh.ch
Received on Tue Dec 23 2003 - 13:26:36 CST

Original text of this message

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