i have the following mysql Stored procedure
create procedure SP_InsertTag_Level2 (tag_v varchar(50), CNT_v int) select tweet_id into @tid from tweet_tags where tag=tag_v; insert into collected_tags (tag,country) select tag_v, A.country from collected_tags A, tweet_tags B where A.tag=B.tag and B.tweet_id=@tid; select id into @Id from collected_tags where tag=tag_v; IF @Id IS NOT NULL THEN insert into stats_tag(id,counter) values (@id,CNT_v); END IF; end;
now i am getting error ERROR 1054 (42S22): Unknown column 'tag_v' in 'field list'
for the bolded line above since tag_v is not a column in collected_tags table (it is parameter in the SP)
how can i keep (insert) a variable in the selected list of columns in the stored procedure?