I'm trying to make a procedure that will create a column in a given table if it doesn't exist. The name of the new column should be taken from the argument I have called "colname".
However this doesnt work, it creates the column, but with the actual name "colname", not the value I call it with. What am I doing wrong here?
delimiter ;;
create procedure autoColumns (colname varchar(64))
begin
declare continue handler for 1060 begin end;
alter table affiliates add colname DECIMAL(5,2);
end;;
call autoColumns('testColumn');;