1

I'm trying to create a stored procedure in phpmyadmin.

My definition is:

BEGIN
INSERT INTO `medication_mapping` (`patient_id`, `active_ingredient_id`, `strength`, `pharmaceutical_dose_form_id`, `number_of_units_per_intake`, `frequency_of_intake`, `date_of_onset`, `duration`, `unit_id`, `status`, `version_id`) VALUES (p_id, a_i_id, str, dose_id, n_u, freq, onset_dt, duration, unit_id, stat, v_id);
END

When I'm trying to save it I get the following message:

One or more errors have occurred while processing your request:
The following query has failed: "CREATE DEFINER=`cefcy`@`localhost` PROCEDURE `insert_medication_mapping`(IN `p_id` INT(11), ) NOT DETERMINISTIC NO SQL SQL SECURITY DEFINER BEGIN INSERT INTO `medication_mapping` (`patient_id`, `active_ingredient_id`, `strength`, `pharmaceutical_dose_form_id`, `number_of_units_per_intake`, `frequency_of_intake`, `date_of_onset`, `duration`, `unit_id`, `status`, `version_id`) VALUES (p_id, a_i_id, str, dose_id, n_u, freq, onset_dt, duration, unit_id, stat, v_id); END"
MySQL said: #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 ') NOT DETERMINISTIC NO SQL SQL SECURITY DEFINER BEGIN INSERT INTO `medication_m' at line 1

This is my medication_mapping table:

enter image description here

This is how my edit routine dialog shows: enter image description here

zinon
  • 4,427
  • 14
  • 70
  • 112

1 Answers1

0

As far as I know in phpMyAdmin, you got to define the entire procedure including delimiters. I personally never add them via myadmin though.

DELIMITER $$
CREATE PROCEDURE insert_medication_mapping()
    BEGIN
        INSERT INTO `medication_mapping` (`patient_id`, `active_ingredient_id`, `strength`, `pharmaceutical_dose_form_id`, `number_of_units_per_intake`, `frequency_of_intake`, `date_of_onset`, `duration`, `unit_id`, `status`, `version_id`) 
        VALUES (p_id, a_i_id, str, dose_id, n_u, freq, onset_dt, duration, unit_id, stat, v_id);
    END$$
DELIMITER ;

What version are you using? There might be some differences. Walkthrough

Thielicious
  • 4,122
  • 2
  • 25
  • 35