2017-01-19 21:44:22 +01:00
|
|
|
CREATE TRIGGER checkIBANatTransfer
|
|
|
|
BEFORE INSERT ON Debit
|
|
|
|
WHEN NEW.targetCredit IS NULL
|
|
|
|
BEGIN
|
2017-02-22 21:58:47 +01:00
|
|
|
SELECT RAISE(ABORT, "IBAN used does not match IBAN currently stored in account record")
|
2017-01-19 21:44:22 +01:00
|
|
|
FROM (
|
|
|
|
SELECT instr(NEW.purpose, IBAN) AS fnd
|
|
|
|
FROM Account
|
|
|
|
WHERE ID=NEW.debtor
|
|
|
|
) AS matchingIBAN
|
|
|
|
WHERE fnd IS NULL OR fnd = 0;
|
|
|
|
END;
|
|
|
|
|