How to check if created_in column is inside trigger?
P粉668113768
P粉668113768 2024-04-03 17:50:59
0
1
324

Column and trigger structures in user tables

CREATE TABLE `users` (
 `created_in` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
trigger event sheet statement time
... insert user IF NEW.created_in = "" THEN

SIGNAL SQLSTATE "45000";

IF END

Before

I'm trying to cancel the insert if the created_in column isn't there but that doesn't work.

How to check whether the created_in column is none?

MySQL version is 5.7

P粉668113768
P粉668113768

reply all(1)
P粉021708275

No trigger is required, session strict mode is enough:

dbviolinhere p>

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!