Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Using constant as part of reference key
Golan wrote:
> Hi all,
> Let's say I have a master table named "MASTER" with the following
> fields:
> Command_Type number(1),
> Timestamp date,
> a number(3),
> b number(3)
>
>
> and to tables "DETAIL1" & "DETAIL2" with the following fields:
> Timestamp date,
> a number,
> c number,
> d number
> ......
>
>
> The primary key for "MASTER" consist of (command_type,timestamp,a) and
> I want to create for bot detail tables a reference key which refers to
> "MASTER" but each table represents a different constant value for the
> command_type field (what I mean is that for example all records in
> DETAIL1 match command_type 1, and all records in DETAIL2 match
> command_type 2. Please notice that commad_type field is not part of
> detail tables).
> What is the syntax for this reference key?
>
> Thanks in advance
Lets say before answering the above you run the following query instead:
SELECT keyword
FROM v$reserved_words
WHERE keyword LIKE 'TIME%';
Then the entire concept of tables named DETAIL1 and DETAIL2 with the same structure flies in the face of all that is holy in relational databases. So don't do it. Rethink the entire project and settle upon a good design with proper naming.
-- Daniel A. Morgan University of Washington damorgan_at_x.washington.edu (replace 'x' with 'u' to respond)Received on Thu Mar 17 2005 - 11:45:56 CST