If I define a variable like set @a = \"1\";
. How can I see that @a is a string?
In MySql, you cannot identify the Datatype of the variable. But there is a way to identify only the strings and Integer by using cast :
set @a = "11";
SELECT CAST(@a AS SIGNED); // Output : 11
set @a = "text";
SELECT CAST(@a AS SIGNED); // Output : 0
set @a = "121212";
SELECT CAST(@a AS SIGNED); // Output : 121212
set @a = "Mysql is open source";
SELECT CAST(@a AS SIGNED); // Output : 0