Skip to content

Instantly share code, notes, and snippets.

@michaelbontyes
Last active February 20, 2020 19:26
Show Gist options
  • Save michaelbontyes/eee2f93005c881b12765f32c4b9f9c85 to your computer and use it in GitHub Desktop.
Save michaelbontyes/eee2f93005c881b12765f32c4b9f9c85 to your computer and use it in GitHub Desktop.
<changeSet id="UniqueID" author="Author" context="Context">
<comment>Comment</comment>
<sql>
set @parent_concept = "OR, Peripheral Nerve Block Section";
set @concept_name = "Bupivacaine";
call reorder_concept_answer(@parent_concept, @concept_name, 0);
</sql>
</changeSet>
CREATE PROCEDURE reorder_concept_answer (
IN concept_name_proc VARCHAR(255),
IN answer_name_proc VARCHAR(255),
IN answer_sort_weight_proc INT)
BEGIN
DECLARE concept_id_proc INT;
DECLARE answer_id_proc INT;
SELECT concept_id INTO concept_id_proc FROM concept_name
WHERE name = concept_name_proc and concept_name_type = "FULLY_SPECIFIED" AND voided = 0;
SELECT concept_id INTO answer_id_proc FROM concept_name
WHERE name = answer_name_proc and concept_name_type = "FULLY_SPECIFIED" AND voided = 0;
UPDATE concept_answer
SET sort_weight = answer_sort_weight_proc
WHERE answer_concept = answer_id_proc
AND concept_id = concept_id_proc;
END;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment