There is an error in the following function creating query:
CREATE FUNCTION `_increase_num` () RETURNS int(11) RETURNS INT READS SQL DATA DETERMINISTIC BEGIN RETURN IF(@counter, @counter:=@counter+1, @counter:=1); END
- Any idea how to fix?
- Can I avoid using ; in the query above? The development framework doesn't allow multiple queries in one call and identifies this one as multiple queries.
EDIT1: The aim of the function to make each row unique, like an autoincreased primary key. But for some development reason I can't use autoincremented primary keys.
EDIT2: The error message is usual, that query failed. You have an error in your query.
EDIT3: I use the function like this way: SELECT _increase_num() as rownr, content FROM mytable
CREATE FUNCTION _increase_num() returns int return IF(@counter, @counter:=@counter+1, @counter:=1)