I need to create a view that has a column named row_num where it will be inserted the row number, just like an auto increment in a normal table.
Let\'s say I\'ve thi
I tried the example of the func_inc_var_session function.
There was a small problem of session variable initialization that I solved using the mysql IFNULL function.
Below the enhanced func_inc_var_session function.
CREATE DEFINER=`root`@`localhost` FUNCTION `func_inc_var_session`() RETURNS int(11)
begin
SET @var := IFNULL(@var,0) + 1;
return @var;
end