When I try to compile this package, I get the error: PLS-00103: Encountered the symbol “BEGIN” when expecting one of the following: end function pragma procedure subtype type current cursor delete exists prior
Can anyone help me, please?
CREATE OR REPLACE PACKAGE PCK_TB_ESTADO
IS
PROCEDURE PRC_INSERE
(P_NM_REDE_FUNCIONARIO IN TB_FUNCIONARIO.NM_REDE_FUNCIONARIO%TYPE,
P_DS_ESTADO IN TB_ESTADO.DS_ESTADO%TYPE,
P_ID_UF IN TB_ESTADO.ID_UF%TYPE,
P_MENS OUT VARCHAR2)
BEGIN
CREATE SEQUENCE SEQ_ESTADO
MINVALUE 1
MAXVALUE 99
START WITH 1
INCREMENT BY 1;
INSERT INTO TB_ESTADO
VALUES (SEQ_ESTADO.NEXTVAL,P_DS_ESTADO,P_ID_UF,SYSDATE,P_NM_REDE_FUNCIONARIO);
COMMIT;
EXCEPTION
WHEN DUP_VAL_ON_INDEX THEN
ROLLBACK;
P_MENS := 'Você tentou executar um comando INSERT ou UPDATE que criou um valor duplicado em um campo restrito por um index único.';
WHEN OTHERS THEN
ROLLBACK;
P_MENS := 'Erro.';
END;
END PCK_TB_ESTADO;
IS
keyword beforeBEGIN
– IncognitoBODY
inCREATE OR REPLACE PACKAGE BODY PCK_TB_ESTADO
. Also, you can't directly create Sequence inside the procedure, that being a DDL command. – IncognitoPACKAGE BODY
. Spec just contains the signature of the procedures/functions – Incognito