> 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: [EMAIL PROTECTED]

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: [EMAIL PROTECTED] (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).

Reply via email to