0

I'm trying to write an SQL (MySQL) Statement here using an if statement but all am getting are countless errors. I've narrowed down to simple instructions but still no breakthrough.

DELIMITER //
CREATE TRIGGER confirmation_triggers AFTER INSERT ON `old_deliquencies`
FOR EACH ROW
IF new.status='True' THEN INSERT INTO `notifications` VALUES(NULL, new.loan_id, "Notification here", curdate());
END IF;
end;
DELIMITER //

The error i get is that i have an error near INSERT INTO...

Can someone help...

3
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by rch1231
0

I tried your code (with the table and some field names changed) and it does not generate an error in my test.

DELIMITER //
CREATE TRIGGER confirmation_triggers AFTER INSERT ON `bielefeld`
FOR EACH ROW
IF new.institution='True' THEN INSERT INTO `notifications` VALUES(NULL, new.institution, "Notification here", CURDATE());
END IF;
END;
DELIMITER //
0

Could there be a problem with my mysql version or some of its configuration settings?

0

Hello,

Just curious what your notifications table looks like? It could be due to one of the fields being set for NOT NULL or something. If the first field is an auto-increment ID field then use '' instead of NULL for the value.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.