I am writing PLSQL trigger for MySQL database. I am trying to declare variables . So i am writing a declare block in the trigger. Here is my following code
CREATE TRIGGER leave_approve_trigger
AFTER UPDATE ON leave_status
FOR EACH ROW
DECLARE //Syntax error
current_id integer;
BEGIN
if NEW.status == 'APPROVED'
THEN
select id into current_id from leave_request_table;
insert into update_table values(current_id);
ENDIF;
END;
The error I get is syntax error for mysql version 5.5.0. Can we actually declare variables. Thanks in advance
=not==