0

I've never done this before, but why do I keep getting and error when I try to create this event. I'm using HeidiSql to do this. Also, can LOOPS, WHILE, IF ELSE be used in events?

BEGIN

DECLARE x TIMESTAMP;
DECLARE y INT;
DECLARE a VARCHAR(50); // Here's where the error is.

SET x = current_timestamp();
insert into checked (stamp) values (x);

SELECT count(stamp) INTO y FROM checked;
        IF y > 10 THEN// It also throws an error here.
            a = 'PASS';
            else
            a = 'FAIL';
        END IF;  

insert into checked (timeCount) values (a);

END
2
  • please specified your exact problem. Commented May 9, 2013 at 9:51
  • @Daniel I'm creating an event. I get /* SQL Error (1064): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '= 'PASS'; else a = 'FAIL'; END IF; inser' at line 17 */ Commented May 9, 2013 at 9:53

2 Answers 2

3

Use

SET  a = 'PASS'; 

instead of

a = 'PASS';

Every where you assign value.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for helping. Like I said I'm doing an even the first time. I was following this: stackoverflow.com/questions/7031469/…
0

Use "DELIMITER" to execute entire block in mysql

such as.....

DELIMITER

//Your code 

DELIMITER;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.