CREATE OR REPLACE PROCEDURE USP_VASCULAR_ACCESS_SITE IS
BEGIN
DECLARE
V_VASCULAR_ACCESS VARCHAR2(50);
V_ACCESS_SITE VARCHAR2(50);
BEGIN
FOR BRESULT IN (SELECT A.PATIENT_ID FROM BPIS_PATIENT_INFO A) LOOP
BEGIN
SELECT A.VASCULAR_ACCESS, A.ACCESS_SITE
INTO V_VASCULAR_ACCESS, V_ACCESS_SITE
FROM BPIS_TREAT_PROGRAM_LIST A
WHERE A.PATIENT_ID = BRESULT.PATIENT_ID
AND ROWNUM = 1;
UPDATE BPIS_PATIENT_INFO A
SET A.VASCULAR_ACCESS = V_VASCULAR_ACCESS,
A.ACCESS_SITE = V_ACCESS_SITE
WHERE A.PATIENT_ID = BRESULT.PATIENT_ID;
EXCEPTION
WHEN OTHERS THEN
NULL;
END;
END LOOP;
END;
END USP_VASCULAR_ACCESS_SITE;