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: Question about Constraint

RE: Question about Constraint

From: Sinardy Xing <SinardyXing_at_bkgcomsvc.com>
Date: Fri, 29 Aug 2003 03:14:30 -0800
Message-ID: <F001.005CDF38.20030829031430@fatcity.com>


Hi,

Unique(companynumber, type)

or

you combine 2 columns together

CompanyNumber_Type (this can become primary key, I don't think you need the id column, pseudo column rownum is the same) You have lesser indexing

123_1
123_2

Sinardy

-----Original Message-----
Sent: 29 August 2003 18:24
To: Multiple recipients of list ORACLE-L

Sounds like 'Companynumber' and 'Type' should be either a compound Primary Key, or a unique index. Which begs the question of what 'Id' is doing - perhaps you don't need it.

peter

-----Original Message-----
Sent: Friday, August 29, 2003 10:39 AM
To: Multiple recipients of list ORACLE-L

Hallo,

I would like to gets ome help on this:

I have this table

Id Companynumber First Name LastName Type

1     123               Jim         Andersson   1
2     234               Tom         Perkins           2
3     565               Henry       Ford        1


I would like to have a constraint so when I try to add and the same companynumber that already exists(for instance 234) I am not allowed to do this if the filed Type has the value 1. So if I add a companynumber which already exists and the Type is 2, then I should be allowed to add this companynumber.

Maybe this is simple but woul dreally appreciate some help onhow to write this.

Roland

--

Please see the official ORACLE-L FAQ: http://www.orafaq.net
--

Author:
  INET: roland.skoldblom_at_ica.se

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
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).

This e-mail message, and any files transmitted with it, are confidential and intended solely for the use of the addressee. If this message was not addressed to you, you have received it in error and any copying, distribution or other use of any part of it is strictly prohibited. Any views or opinions presented are solely those of the sender and do not necessarily represent those of the British Geological Survey. The security of e-mail communication cannot be guaranteed and the BGS accepts no liability for claims arising as a result of the use of this medium to transmit messages from or to the
BGS. .                            http://www.bgs.ac.uk
*********************************************************************

--

Please see the official ORACLE-L FAQ: http://www.orafaq.net
--

Author: Robson, Peter
  INET: pgro_at_bgs.ac.uk

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
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).
--

Please see the official ORACLE-L FAQ: http://www.orafaq.net
--

Author: Sinardy Xing
  INET: SinardyXing_at_bkgcomsvc.com
Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
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 Fri Aug 29 2003 - 06:14:30 CDT

Original text of this message

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