2016-03-17 4 views
0

Я хотел бы создать таблицу PL PL, в которой хранятся пользовательские сообщения об ошибках , но при попытке присвоить сообщение моей таблице я получаю сообщение об ошибке.PLSQL - PACKAGE

Похоже, что существует проблема при попытке доступа к таблице с использованием индекса '-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. 

ответ

0

Вы получаете эту ошибку, потому что вы пытаетесь установить содержимое массива изнутри раздел декларации. Вы не можете этого сделать - вам придется делать это в корпусе пакета (да, у пакетов может быть раздел BEGIN из их самого!).

Однако, я думаю, вы, вероятно, после чего-то вроде пользовательского пакета ошибок, упомянутого in this post.

+0

Спасибо, что вы были правы, и действительно, эта связь помогла мне найти новые идеи;) –

Смежные вопросы