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: CHECK Integrity constraint help

Re: CHECK Integrity constraint help

From: Michel Cadot <micadot{at}altern{dot}org>
Date: Fri, 17 Sep 2004 21:13:27 +0200
Message-ID: <414b3731$0$878$636a15ce@news.free.fr>

"sali" <skhan_at_mdsp.org> a écrit dans le message de news:TqG2d.9$Ov3.1217_at_news.abs.net...
> I have this table called Faculty_Schedule, which contains a faculty member's
> schedule for a particular semester. In the creation of the table, I need to
> add a check constraint where the teacher can not teach more than 4 classes
> per semester. Here is what i have so far.
>
> CREATE TABLE faculty_schedule(
> fac_schedule_id NUMBER(2),
> faculty_semster VARCHAR(6),
> faculty_id NUMBER(5),
> course_id NUMBER(5),
> CONSTRAINT fac_sch_id_pk PRIMARY KEY (fac_schedule_id),
> CONSTRAINT course_id_fk FOREIGN KEY (course_id) REFERENCES courses
> (course_id),
> CONSTRAINT faculty_id_fk FOREIGN KEY (faculty_id) REFERENCES faculty
> (faculty_id));
>
> How would I include this CHECK constraint in here. This is the first time
> im writing something that has this type of constraint so I am a little
> confused about the way it should be done.. Any help would be appreciated.
> Thanks in advance.
>
>

You cannot create a declarative constraint across several rows. You have to create a trigger for that.

Have a look at:
http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96590/adg13trg.htm#376

-- 
Regards
Michel Cadot
Received on Fri Sep 17 2004 - 14:13:27 CDT

Original text of this message

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