SELECT code_type,code,encounter,pid,provider_id,date,CONCAT('code_tye',':','code') INTO @code_type,@code,@encounter,@pid,@povider_id,@date,@standard_code FROM billing
FOR EACH ROW
BEGIN
SELECT procedure_type_id INTO @type_id FROM procedure_type WHERE standard_code='@standard_code'
FOR EACH ROW
BEGIN
INSERT INTO procedure_order(procedure_type_id,date_ordered,provider_id,date_collected,order_priority,order_status
,patient_instructions,patient_id,encounter_id) VALUES('@type_id','@date','@provider_id','@date','high','pending','complaints','@pid','@encounter')
END
END
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'EACH ROW BEGIN SELECT procedure_type_id INTO @type_id FROM procedure_type WHERE ' at line 2
what is the problem ?