Mayur Patel
Mayur Patel

Reputation: 1751

How to set values of variable using SET in MySql?

How to set values to variable using SET in MySql?

Upvotes: 0

Views: 59

Answers (1)

vhu
vhu

Reputation: 12818

You don't need to declare the user defined variables, you can just SET them as you have in your question. Once variable is set you can refer to it in SELECT or other statements, for example:

SELECT @_achat_loc;

+-------------+
| @_achat_loc |
+-------------+
| achat       |
+-------------+
1 row in set (0.00 sec)

or

UPDATE a SET b=@_achat_loc;

Upvotes: 1

Related Questions