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...

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 //

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

I wouldn't know of any version issues regarding your problem. Did you try a line break before the INSERT ?

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.