drop procedure if exists public.sp_SyncMedicalExamination;
-- =============================================
-- Author:  Michael Panin
-- Create date: 2023/08/08
-- Description: Обновление ссылок на DOCTOR_WARD_EXAMINATION
-- =============================================

CREATE procedure public.sp_SyncMedicalExamination
(
	"newDweId" UUID -- Идентификатор нового DOCTOR_WARD_EXAMINATION
,	"oldDweId" UUID -- Идентификатор старого DOCTOR_WARD_EXAMINATION
)

AS
$$ 
BEGIN

    UPDATE AKUZ.T_MEDICAL_EXAMINATION_RE
    SET    MedicalExaminationMain = "newDweId"
    WHERE  MedicalExaminationMain = "oldDweId";

END;
$$ 
LANGUAGE plpgsql;
