Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2003
    Location
    brussels
    Posts
    3

    Unanswered: initialisation of varray(ORACLE 8i)

    Hello,
    I created a package that compiled perfect but when I executed I'm getting an error of type uninitialised collection because I'm using a varray that isn't initialised. I can't initialised the varray because it has too many elements and if I do initialised only a couple of elements I get a run time error Subscript beyond count.
    Thanks for helping.
    Ibra

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1

    Re: initialisation of varray(ORACLE 8i)

    [QUOTE][SIZE=1]Originally posted by ibra
    When you declare the VARRAY you can initialise it like this:

    DECLARE
    TYPE t IS VARRAY(100) OF NUMBER;
    var t := t();
    ...

    You can then use the EXTEND method to make all the subscripts valis:

    BEGIN
    var.extend(100);

    You can now access any element of var.

  3. #3
    Join Date
    Mar 2003
    Location
    brussels
    Posts
    3

    Talking Re: initialisation of varray(ORACLE 8i)

    hello Andrew
    Thanks a lot for your help that was the peace of the puzzle and in top of it I'm a new pl/sql prog
    Ibra
    [QUOTE][SIZE=1]Originally posted by andrewst
    Originally posted by ibra
    When you declare the VARRAY you can initialise it like this:

    DECLARE
    TYPE t IS VARRAY(100) OF NUMBER;
    var t := t();
    ...

    You can then use the EXTEND method to make all the subscripts valis:

    BEGIN
    var.extend(100);

    You can now access any element of var.

  4. #4
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1

    Re: initialisation of varray(ORACLE 8i)

    Originally posted by ibra
    hello Andrew
    Thanks a lot for your help that was the peace of the puzzle and in top of it I'm a new pl/sql prog
    Ibra
    That's OK. I can't say I really understand WHY you have to "extend" a VARRAY just to use the elements you already declared!

  5. #5
    Join Date
    Mar 2003
    Location
    brussels
    Posts
    3

    Re: initialisation of varray(ORACLE 8i)

    You right andrew I don't understand either.
    I have another question because now I'm getting an error of type
    ERREUR la ligne 1 :
    ORA-01840: input value not long enough for date format
    ORA-06512: at "INTRA.OPR_PCK_CATIT", line 160
    ORA-06512: at line 1
    and actually the line his refering too is like this
    FETCH C_initFldInf INTO A,B,C,D,E,F,G,H,I;
    Thanks

    Originally posted by andrewst
    That's OK. I can't say I really understand WHY you have to "extend" a VARRAY just to use the elements you already declared!

  6. #6
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1

    Re: initialisation of varray(ORACLE 8i)

    There must be a TO_DATE in the select statement of that cursor on a VARCHAR2 value that is not in the right format.

    Example:

    SQL> select to_date('01-JAN','DD-MON-YYYY') from dual
    2 /
    select to_date('01-JAN','DD-MON-YYYY') from dual
    *
    ERROR at line 1:
    ORA-01840: input value not long enough for date format

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •