Set variable in MySQL

teammatt3's picture

He has: 2,102 posts

Joined: Sep 2003

I'm playing with triggers in MySQL (5.0.27) and I'm using the MySQL Query browser to do it. However, when it comes to setting variables, the GUI just can't handle it for some reason. If I do something like this:

SET @testing = 5;
SELECT @testing;

I get one NULL row returned. However, if I do the same thing in the mysql command line, it works just fine.

Does the GUI just not handle variables? Or do I need to switch something on? I just don't get it...

JeevesBond's picture

He has: 3,955 posts

Joined: Jun 2002

See what you mean. I think the problem is that the Query Browser can't run two queries sequentially, you have to enter/run the queries individually. Also, if you miss out the SET statement the result is the same: a blank line.

Everything else works, you can still write triggers, functions, views etc. just use the command line for testing. Good

a Padded Cell our articles site!

carloncho's picture

They have: 17 posts

Joined: Jan 2008

I suggest t use Toad for MySQL to work with this things like triggers or procedures.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.