I tried that - that just allows everything as opposed to allowing nothing!
Charles Sikora Coordinator, Gas Storage Manlove Field Peoples Energy Corporation -----Original Message----- From: Claudine Robbins [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 02, 2002 10:42 AM To: [EMAIL PROTECTED] Subject: RE: Use a trigger instead of a rule? Your rule is testing not equal (NOT IN), doesn't it test for any value other than 1 instead of for 1? In other words, shouldn't your rule read IN instead of NOT IN ~Claudine :) ----------------------------------------------------------------- I am trying to write a rule that accomplishes the following goal: Rule will prevent a row from being added to the table Qualified_Detail under the following condition: if an emp_id, task_id, and qual_type = 1 exist, then do not allow the row to be added. This means that for that same emp_id and task_id, that if qual_type = something other than 1, the row should be added. Already existing row: empid =124 task_id =1 qual_type = 1 cladode = 8/1/2002 Do not allow the following to be added: empid = 124 task_id = 1 qual_type = 1 qual_date = 8/5/2002 BUT DO allow the following to be added: empid = 124 task_id = 1 qual_type = 2 qual_date = 8/5/2002 The rule I wrote is to Add/modify if the select fails WHERE qual_type NOT IN (select ssn task_id qual_type FROM qualified_detail t1 WHERE t1.ssn = qualified_detail.ssn AND t1.task_id = qualified_detail.task_id AND t1.qual_type = 1) Otherwise display message "Employee has already been initially qualified on this task" What is happening now is that any attempt to insert a row into the table is failing under this rule, regardless of what the qual_type is.. I know how to write a rule testing for uniqueness (which is basically what this is), but throwing the qual_type = 1 is perhaps throwing a wrench into things. Thanks for any assistance .. Charles Sikora Coordinator, Gas Storage Manlove Field Peoples Energy Corporation ================================================ TO SEE MESSAGE POSTING GUIDELINES: Send a plain text email to [EMAIL PROTECTED] In the message body, put just two words: INTRO rbase-l ================================================ TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED] In the message body, put just two words: UNSUBSCRIBE rbase-l ================================================ TO SEARCH ARCHIVES: http://www.mail-archive.com/rbase-l%40sonetmail.com/ ================================================ TO SEE MESSAGE POSTING GUIDELINES: Send a plain text email to [EMAIL PROTECTED] In the message body, put just two words: INTRO rbase-l ================================================ TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED] In the message body, put just two words: UNSUBSCRIBE rbase-l ================================================ TO SEARCH ARCHIVES: http://www.mail-archive.com/rbase-l%40sonetmail.com/ ================================================ TO SEE MESSAGE POSTING GUIDELINES: Send a plain text email to [EMAIL PROTECTED] In the message body, put just two words: INTRO rbase-l ================================================ TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED] In the message body, put just two words: UNSUBSCRIBE rbase-l ================================================ TO SEARCH ARCHIVES: http://www.mail-archive.com/rbase-l%40sonetmail.com/
