5299966837
With FAIL, triggers choke but leave the changes in despite. We need to have the current statement undone, however.
14 lines
353 B
SQL
14 lines
353 B
SQL
CREATE TRIGGER checkIBANatTransfer
|
|
BEFORE INSERT ON Debit
|
|
WHEN NEW.targetCredit IS NULL
|
|
BEGIN
|
|
SELECT RAISE(ABORT, "IBAN used does not match IBAN currently stored in account record")
|
|
FROM (
|
|
SELECT instr(NEW.purpose, IBAN) AS fnd
|
|
FROM Account
|
|
WHERE ID=NEW.debtor
|
|
) AS matchingIBAN
|
|
WHERE fnd IS NULL OR fnd = 0;
|
|
END;
|
|
|