I have a trigger like this
CREATE
TRIGGER `hrm_to_odm_user` AFTER INSERT
ON `ohrm_user`
FOR EACH ROW BEGIN
DECLARE _dep_id INTEGER;
SELECT eeo_cat_code INTO _dep_id FROM hs_hr_employee WHERE emp_number = NEW.id;
INSERT INTO zodm_user (id, username, password, department) VALUES (NEW.id, NEW.user_name, NEW.user_password, _dep_id);
END
After inserting data to ohrm_user i fire the trigger to insert values to zodm_user
It works fine for everything else other than this field _dep_id which i select from another table named hs_hr_employee
I have gone thru this post
MySQL Trigger Update with select from another table
but it is not working for me
Thanks