Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2002
    Location
    Belgium
    Posts
    6

    Unanswered: PL/SQL PLS-00306 error

    Hi all,

    I have created a package (that compiled ok) with a function in it called SPLIT :

    B]FUNCTION Split( sString in VARCHAR2, sDelim IN VARCHAR2, tReturn IN OUT nocopy t1000Varchar) return NUMBER;[/B]

    And I call this function in another package :

    iUBound := EP_PCK_TOOLS.SPLIT( sString, sDelim, tRes);

    The parameters are defined and of the same type as those in the EP_PCK_TOOLS package (except that the T1000Varchar type is declared in both packages, both identical).

    when compiling (I use the freeware version of TOAD) I receive the following error :

    PLS-00306: wrong number or types of arguments in call to Split

    I tried changing IN OUT to OUT for the tReturn parameter, but no cigar.
    Could it have to do with the initialisation of the tRes variable in the calling procedure ? (currently initialised with extend(1000)).

    Thanks

    Dirk van den Oudenhoven.
    Belgium.

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

    Re: PL/SQL PLS-00306 error

    Originally posted by dirkvdo
    The parameters are defined and of the same type as those in the EP_PCK_TOOLS package (except that the T1000Varchar type is declared in both packages, both identical).
    Identical isn't good enough, I'm afraid - they have to be of THE same type. You will have to declare the type in the specification of one package, and use it in both packages.

    See this:

    SQL> declare
    2 type t1 is record( a number );
    3 type t2 is record( a number );
    4 v1 t1;
    5 v2 t2;
    6 begin
    7 v1.a := 1;
    8 v2 := v1;
    9* end;
    SQL> /
    declare
    *
    ERROR at line 1:
    ORA-06550: line 8, column 9:
    PLS-00382: expression is of wrong type

  3. #3
    Join Date
    Jun 2002
    Location
    Belgium
    Posts
    6

    Re: PL/SQL PLS-00306 error

    I allready suspected the array type having to do something with my problem...
    But regarding your solution, a type, declared in one package, is it available to other packages too ? If so, why don't I get an error when compiling the second package where an identical type is declared (this is: with the same name and type declaration :

    TYPE t1000VarChar as VARRAY(1000) of VARCHAR2(2000);

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

    Re: PL/SQL PLS-00306 error

    Originally posted by dirkvdo
    I allready suspected the array type having to do something with my problem...
    But regarding your solution, a type, declared in one package, is it available to other packages too ? If so, why don't I get an error when compiling the second package where an identical type is declared (this is: with the same name and type declaration :

    TYPE t1000VarChar as VARRAY(1000) of VARCHAR2(2000);
    A type declared in the SPECIFICATION of one package is available to other packages too.

    The reason you don't get an error when you declare a type with the same name in another package is the same as the reason you don't get an error if you declare a procedure with the same name as a procedure in another package - scope.

    Consider:

    CREATE OR REPLACE PACKAGE p1 IS
    TYPE t1 IS VARRAY(10) OF NUMBER;
    v1 t1;
    END;
    /
    CREATE OR REPLACE PACKAGE p2 IS
    TYPE t1 IS TABLE OF VARCHAR2(10);
    v1 t1;
    v2 p1.t1;
    END;
    /

    This is perfectly valid. The variable v1 in package p1 is of type p1.t1 (we didn't specify p1, but it is implicit). The variable v1 in package p2 is of type p2.t1. The variable v2 in package p2 of of type p1.t1 (because we explicitly said so).

    To use a type declared in one package elsewhere, you must prefix the type name with the owning package name (same as when you call a procedure from another package).

Posting Permissions

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