Hi Listmembers, today I have the following question: I tried to develope an INSERT-Trigger that checks the value of one column in a new inserted row. The following example shows my idea:
CREATE TABLE test2 ( id DEFAULT SERIAL PRIMARY KEY, telefon CHAR(20)) // CREAT TRIGGER telefontest FOR test2 AFTER INSERT EXECUTE ( VAR laenge INT; zaehler INT; fehler INT; zeichen CHAR(1); SET laenge = length(NEW.telefon); SET fehler = 0; SET zaehler = 0; WHILE zaehler < laenge DO BEGIN SET zaehler = zaehler + 1; SET zeichen = substr(NEW.telefon, zaehler, 1); IF zeichen NOT IN ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '-', '(', ')', '/') THEN SET fehler = 1; END; IF fehler = 1 THEN STOP (666, 'Telefontrigger'); ) But when I now try to insert a new row, I have to commit that sql-statement two times before it will be executed. Lets say I enter the following statement in SQL Studio: INSERT INTO test2 (telefon) VALUES ('+49-(0)1234/567890') To get this row inserted into the table test2 it is necessary to hit two times the [F8]-key (= commit). Altough when I try to insert a row that does not meet the constraint, I have to doublecommit the statement before I get the error. Can someone please explain me what I do wrong and what I can do to prevent this behaviour? I use MaxDB 7.6.00.10 and SQL Studio on a WindowsXP-Home based notebook. Thanks for help and comments! Regards, Andreas -- GMX DSL = Maximale Leistung zum minimalen Preis! 2000 MB nur 2,99, Flatrate ab 4,99 Euro/Monat: http://www.gmx.net/de/go/dsl -- MaxDB Discussion Mailing List For list archives: http://lists.mysql.com/maxdb To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]