in MYSQL i have a myfield column in mytable table which has let's say a varchar(8) data type
CREATE TABLE mytable (
id INT NOT NULL,
myfield VARCHAR( 8 ))
in a function or procedure i'd like to refer to myfield datatype, something like that:
DECLARE myvar mytable.myfield%TYPE
in alternative to explicitly declare it
DECLARE myvar VARCHAR( 8 )
Is there a way in a MYSQL function or procedure, to refer to a column datatype when declaring variable o return type? thanks