我想创建一个PL SQL表来存储用户定义的错误消息,但是当尝试将消息分配给我的表时,我得到了一个错误。
在尝试使用索引'-20001‘访问表时,似乎存在一个问题。
我做错了吗?
以下是代码
create or replace PACKAGE GESTIONNAGEURS
AS
-- ----- TYPES ----- --
TYPE T_TableNageurs IS TABLE OF Nageurs%ROWTYPE INDEX BY PLS_INTEGER;
TYPE T_Exception IS TABLE OF VARCHAR2(256) INDEX BY BINARY_INTEGER;
-- ----- EXCEPTIONS ----- --
V_ExTable T_Exception;
ExParaListerNULL EXCEPTION;
V_ExTable(20001) := 'Erreur : Fonction Lister : Au moins un des parametres est NULL!';
ExParaListerINV EXCEPTION;
V_ExTable(-20002) := 'Erreur : Fonction Lister : Au moins un des parametres est INVALIDE!';
ExNageuses EXCEPTION;
V_ExTable(-20003) := 'Erreur : Fonction Lister : ';
ExParaSupprNULL EXCEPTION;
V_ExTable(-20004) := 'Erreur : Procedure Supprimer : Au moins un des parametres est NULL!';
ExParaSupprINV EXCEPTION;
V_ExTable(-20005) := 'Erreur : PROCEDURE Supprimer : Au moins un des parametres est INVALIDE!';
ExDelete EXCEPTION;
V_ExTable(-20006) := 'Erreur : Procedure Supprimer : ';
ExParaMod EXCEPTION;
V_ExTable(-20007) := 'Erreur : Procedure Modifier : Au moins un des parametres est NULL!';
-- ----- METHODES ----- --
FUNCTION LISTER ( P_NRCOMPETITION IN NUMBER, P_ANNEE IN NUMBER, P_NRJOUR IN NUMBER ) RETURN T_TableNageurs;
-- ----- PROCEDURES ----- --
PROCEDURE SUPPRIMER ( P_NRLIGUE IN Nageurs.NrLigue%TYPE, P_ANNEE IN Nageurs.AnneeNaiss%TYPE );
/* TODO enter package declarations (types, exceptions, methods etc) here */
END GESTIONNAGEURS;
下面是我得到的错误消息:
Erreur(11,12): PLS-00103: Encountered the symbol "(" when expecting one of the following: constant exception <identificateur> <identificateur entre guillemets> table long double ref char time timestamp interval date binary national character nchar The symbol "<identificateur>" was substituted for "(" to continue.
Erreur(14,12): PLS-00103: Encountered the symbol "(" when expecting one of the following: constant exception <identificateur> <identificateur entre guillemets> table long double ref char time timestamp interval date binary national character nchar The symbol "<identificateur>" was substituted for "(" to continue.
Erreur(17,12): PLS-00103: Encountered the symbol "(" when expecting one of the following: constant exception <identificateur> <identificateur entre guillemets> table long double ref char time timestamp interval date binary national character nchar The symbol "<identificateur>" was substituted for "(" to continue.
Erreur(20,12): PLS-00103: Encountered the symbol "(" when expecting one of the following: constant exception <identificateur> <identificateur entre guillemets> table long double ref char time timestamp interval date binary national character nchar The symbol "<identificateur>" was substituted for "(" to continue.
Erreur(23,12): PLS-00103: Encountered the symbol "(" when expecting one of the following: constant exception <identificateur> <identificateur entre guillemets> table long double ref char time timestamp interval date binary national character nchar The symbol "<identificateur>" was substituted for "(" to continue.
Erreur(26,12): PLS-00103: Encountered the symbol "(" when expecting one of the following: constant exception <identificateur> <identificateur entre guillemets> table long double ref char time timestamp interval date binary national character nchar The symbol "<identificateur>" was substituted for "(" to continue.
Erreur(29,12): PLS-00103: Encountered the symbol "(" when expecting one of the following: constant exception <identificateur> <identificateur entre guillemets> table long double ref char time timestamp interval date binary national character nchar The symbol "<identificateur>" was substituted for "(" to continue.
发布于 2016-03-17 22:56:27
之所以会出现这个错误,是因为您试图从声明部分中设置数组的内容。您不能这样做--您必须在包体中这样做(是的,包可以有它们自己的BEGIN部分!)
然而,我认为你可能想要一些像in this post提到的自定义错误包的东西。
https://stackoverflow.com/questions/36063197
复制相似问题