DECLARE not working in MYSQL TRIGGER
<p>this is my first trigger and my very first pl/sql code.</p>

<p>the variable declaration in the following trigger is not working and I can not check for the other errors.</p>

<pre><code>[CREATE TRIGGER insert_rollno
BEFORE INSERT ON exam_candidate
FOR EACH ROW

BEGIN
    DECLARE max_num INTEGER(4);
    DECLARE apply INTEGER(10);
    DECLARE reg_yr VARCHAR(2);

    @reg_yr:=SUBSTRING(NEW.regno,12,2);
    SELECT MAX(num)
    INTO max_num
    FROM exam_candidate
    WHERE course_id=NEW.course_id
    AND semester=NEW.semester
    AND yr=NEW.yr;

    SELECT MAX(application)
    INTO apply
    FROM exam_candidate;

    @max_num:=@max_num+1;
    @apply:=@apply+1;

    INSERT INTO exam_candidate(rollno,num,application,regno,course_id,semester,yr,enrollment_dt)
    VALUES(CONCAT(reg_yr,'/',NEW.course_id,'/',CHAR(NEW.yr),CHAR(NEW.semester),CHAR(max_num)),max_num,apply,NEW.regno,NEW.course_id,NEW.semester,NEW.yr,SYSDATE());
END][1]
</code></pre>

<p>please help me solving this problem. </p>