Im trying to declare a variable i mysql but strangely none of these commands are working. Ive snipped these commands from stackoverflow solved questions and while these seem to work for most of the people , its throwing same error on my system.
MySQL Server version: 5.7.26-0ubuntu0.18.10.1 (Ubuntu)
> declare @d1 decimal(10,2)
> declare d1 float(10);
> declare `d1` BIGINT(2);
> declare d1 INT;
All these are giving same error
ERROR 1064 (42000): You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right syntax
to use
Also, this command print nothing for me, no error just blanks :-
-> DECLARE @COURSE_ID INT
-> SELECT @COURSE_ID = 5
-> PRINT @COURSE_ID
->
-> ;
->
->