adspace


How to declare variable in mysql trigger?

Answer Posted / Santosh Kumar Bhart

To declare a variable inside a MySQL trigger, you can use the DECLARE keyword followed by the variable name and data type. For example: 'CREATE TRIGGER my_trigger BEFORE INSERT ON my_table FOR EACH ROWn BEGINn DECLARE new_id INT;n SET new_id = (SELECT LAST_INSERT_ID());n END;'.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is current version of mysql?

1081


How to Change a users password from unix shell.

1221


Which statement is used in a select query for partial matching?

1247


What is the current mysql version?

1103