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

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Unique value

Re: Unique value

From: Stephane Faroult <sfaroult_at_oriole.com>
Date: Mon, 02 Sep 2002 00:13:21 -0800
Message-ID: <F001.004C552E.20020902001321@fatcity.com>


> sultan wrote:
>
> Hi friends,
>
>
> I have a tables A and B
>
> DESC A
> ------------
> ID NUMBER
> NAME VARHAR2(10)
>
> DESC B
> -----------
> ID NUMBER
> SUBNAME VARCHAR2(20);
>
>
>
> In the above table B.ID is the foreign key to A.ID.
>
> How can I create unique value for B.SUBNAME based on A.NAME.
>
> Means , A.NAME has value 'AAAA" and
> B.SUBNAME has values 'BBBB', 'CCCC';
> when I insert value again in B.SUBNAME as 'BBBB' it
> should not agree for the combination value of A.NAME('AAAA'),
> but 'BBBB' can agree when I enter value for A.NAME
> other than 'AAAA'
>
> Please give some ideas,
>
> Thanks in advance
>
> syed.

Unique index on (id, subname), that's what concatenated indices are for.

-- 
Regards,

Stephane Faroult
Oriole Software
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Stephane Faroult
  INET: sfaroult_at_oriole.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Mon Sep 02 2002 - 03:13:21 CDT

Original text of this message

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