Set mysql variable with the name {parametro1}

0

The way to set a variable in mysql is like this:

SET @variavel = valor

In Documentation says that the variable name can contain other characters, and in the case it should be set SET @'variavel' = valor .

Is it possible to create mysql variable containing the characters { and } ?

    
asked by anonymous 31.10.2015 / 17:22

1 answer

3

After spending a few seconds doing a test, I got the following answer:

Yes, it is possible


The test:

set @'{banana}' = 10;
select @'{banana}'

The result:

10

See the test done and running online at SQL Fiddle

>


Update:

Just to make sure the documentation is correct :), I tried without the quotes and the result was this:

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 '{banana} = 10' at line 1
    
31.10.2015 / 19:52