PLSQL-PACKAGE

PLSQL-PACKAGE,plsql,package,instantiation,Plsql,Package,Instantiation,我想创建一个PL SQL表来存储用户定义的错误消息 但是当尝试将消息分配给我的表时,我得到了一个错误 在尝试使用索引'-20001'访问表时,似乎存在问题 我做错了吗 这是密码 create or replace PACKAGE GESTIONNAGEURS AS -- ----- TYPES ----- -- TYPE T_TableNageurs IS TABLE OF Nageurs%ROWTYPE INDEX BY PLS_INTEGER; TYPE T_Excep

我想创建一个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. 
Erreur(11,12):PLS-00103:遇到符号“(”当期望以下情况之一时:常数异常表长双参考字符时间戳间隔日期二进制国家字符nchar符号“”被替换)()继续。
Erreur(14,12):PLS-00103:遇到符号“(”当预期以下情况之一时:常数异常表长双参考字符时间戳间隔日期二进制国家字符nchar符号“”被替换为“(”以继续)。
Erreur(17,12):PLS-00103:遇到符号“(”当预期以下情况之一时:常数异常表长双参考字符时间戳间隔日期二进制国家字符nchar符号“”被替换为“(”以继续)。
Erreur(20,12):PLS-00103:遇到符号“(”当期望以下情况之一时:常数异常表长双参考字符时间戳间隔日期二进制国家字符nchar符号“”被替换为“(”以继续)。
Erreur(23,12):PLS-00103:遇到符号“(”当预期以下情况之一时:常数异常表长双参考字符时间戳间隔日期二进制国家字符nchar符号“”被替换为“(”以继续。
Erreur(26,12):PLS-00103:遇到符号“(”当预期以下情况之一时:常数异常表长双参考字符时间戳间隔日期二进制国家字符nchar符号“”被替换为“(”以继续)。
Erreur(29,12):PLS-00103:遇到符号“(”当预期以下情况之一时:常数异常表长双参考字符时间戳间隔日期二进制国家字符nchar符号“”被替换为“(”以继续。

出现此错误是因为您试图在声明部分内设置数组的内容。您不能这样做-您必须在包体中执行此操作(是的,包可以有自己的开始部分!)


不过,我认为您可能正在寻找类似上述自定义错误包的内容。

谢谢您的回答,事实上,该链接帮助我找到了一些新想法;)