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 :)
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Bill Downall Sent: Wednesday, October 02, 2002 10:18 AM To: RBase List Server Subject: >From [EMAIL PROTECTED] Wed Oct 2 10:53:40 2002 Received: from pecorp.com (relay.pecorp.com [208.216.27.52]) by sonet.rxcpi.net (8.9.3/8.9.3) with ESMTP id KAA30429 for <[EMAIL PROTECTED]>; Wed, 2 Oct 2002 10:53:40 -0400 From: [EMAIL PROTECTED] Received: from ([10.10.40.40]) by im-relay.pecorp.com with ESMTP ; Wed, 02 Oct 2002 09:55:55 -0500 (CDT) Received: by relay.pecorp.com with Internet Mail Service (5.5.2653.19) id <SS3V3J2A>; Wed, 2 Oct 2002 10:01:44 -0500 Message-ID: <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Subject: Rules in RBW6.5++ Date: Wed, 2 Oct 2002 10:01:35 -0500 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="ISO-8859-1" 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/
