首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >PLSQL - PACKAGE

PLSQL - PACKAGE
EN

Stack Overflow用户
提问于 2016-03-17 22:17:03
回答 1查看 76关注 0票数 0

我想创建一个PL SQL表来存储用户定义的错误消息,但是当尝试将消息分配给我的表时,我得到了一个错误。

在尝试使用索引'-20001‘访问表时,似乎存在一个问题。

我做错了吗?

以下是代码

代码语言:javascript
运行
复制
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;

下面是我得到的错误消息:

代码语言:javascript
运行
复制
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. 
EN

回答 1

Stack Overflow用户

发布于 2016-03-17 22:56:27

之所以会出现这个错误,是因为您试图从声明部分中设置数组的内容。您不能这样做--您必须在包体中这样做(是的,包可以有它们自己的BEGIN部分!)

然而,我认为你可能想要一些像in this post提到的自定义错误包的东西。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/36063197

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档