I am writing Perl regex code to separate out PL/SQL procedure from the package.
Each procedure starts with the PROCEDURE key word and ends with END, But the END is for BEGIN, IF, or LOOP. There may be many BEGIN|IF|LOOP.
Below is the kind of input, I want to separate each procedure. How can I do this?
PROCEDURE LOG_ECS_MSG( MD_CURR CHAR,
MSG_TIME DATE ) IS
PRAGMA AUTONOMOUS_TRANSACTION;
BEGIN
BEGIN
INSERT INTO INFO_SERV_ECS_LOG
VALUES ( MD_CURR, MD, SVTY, ACT_DATE, ACCT, MSG_TXT, MSG_TIME);
COMMIT;
END;
END;
PROCEDURE LOG_ECS_MSG( MD_CURR CHAR,
MSG_TIME DATE ) IS
PRAGMA AUTONOMOUS_TRANSACTION;
BEGIN
IF....
INSERT INTO INFO_SERV_ECS_LOG
VALUES ( MD_CURR, MD, SVTY, ACT_DATE, ACCT, MSG_TXT, MSG_TIME);
COMMIT;
END IF
END;