I am trying to define and initialize a MySQL variable for a query.
I have the following:
declare @countTotal int; SET @countTotal = select COUNT(*) from
Function example:
DROP FUNCTION IF EXISTS test; DELIMITER $$ CREATE FUNCTION test(in_number INT) RETURNS INT BEGIN DECLARE countTotal INT; SET countTotal = SELECT COUNT(*) FROM nGrams; RETURN countTotal + in_number; END $$ DELIMITER ;