Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> PL/SQL strange error :((

PL/SQL strange error :((

From: Laurent Boulard <Laurent.Boulard_at_icl.com>
Date: Thu, 27 May 1999 15:40:39 +0100
Message-ID: <374d572c.0@145.227.194.253>


For two days now, I don't understand why when I try this little piece of code, I get a error.
I checked memory space and syntax, looked in each part of thePL/SQL User's guide and reference.
This code is for a Oracle Server 8.0.5.

create or replace package tpccrand is
--

        type Tperm is varray (3000) of integer;
        randperm3000 Tperm;

--

   type Tlastname is varying array (10) of varchar2(10);

        lastname Tlastname :=
      T_lastname( 'BAR',   'OUGHT', 'ABLE', 'PRI',
                  'PRES',  'ESE',   'ANTI', 'CALLY',
                  'ATION', 'EING'
                );

--
procedure initperm; procedure randstr (str out varchar2, x in integer, y in integer); procedure randdatastr (str out varchar2, x in integer, y in integer); procedure randnum (str out varchar2, len in integer); procedure randlastname (str out varchar2, id in integer); function NURand (A in integer, x in integer, y in integer, cnum in integer) return integer;
end tpccrand;
/
show errors;

create or replace package body tpccrand is

        procedure initperm is
                pos binary_integer;
                temp integer;
                i binary_integer;
        begin
                for i in 0..2999 loop
                        randperm3000(i) := i+1;
                end loop;

                for i in reverse 3000..1 loop
                        pos := mod(random.val(0,3000),i);
                        temp := randperm3000(i-1);
                        randperm3000(i-1) := randperm3000(pos);
                        randperm3000(pos) := temp;
                end loop;
        end initperm;

        procedure randstr (str out varchar2, x in integer, y in integer) is
                i binary_integer;
                j binary_integer;
                len binary_integer;
        begin
                len := random.val(x,y+1);
                str := '';
                for i in 0..len-1 loop
                        j := random.val(0,62);
                        if j < 26 then
                                str := str || chr(j + 97);
                        elsif j < 52 then
                                str := str || chr(j + 65 - 26);
                        else
                                str := str || chr(j + 48 - 52);
                        end if;
                end loop;
        end randstr;

        procedure randdatastr (str out varchar2, x in integer, y in integer)
is
                i binary_integer;
                j binary_integer;
                len binary_integer;
                pos binary_integer;
        begin
                len := random.val(x,y+1);
                str := '';
                for i in 0..len-1 loop
                        j := random.val(0,62);
                        if j < 26 then
                                str := str || chr(j + 97);
                        elsif j < 52 then
                                str := str || chr(j + 65 - 26);
                        else
                                str := str || chr(j + 48 - 52);
                        end if;
                end loop;
                if ( random.val(0,10) = 0 ) then
                        pos := random.val(1,len-8);
                        str := substr(str,1,pos-1) || 'ORIGINAL' ||
substr(str,p
os+8);
                end if;
        end randdatastr;

        procedure randnum(str out varchar2,len in integer) is
                i binary_integer;
        begin
                str := '';
                for i in 1..len loop
                        str := str || chr(48 + random.val(0,10));
                end loop;
        end randnum;

        procedure randlastname (str out varchar2,id in integer) is
        begin
                id := mod(id,1000);
                str := lastname(id/10);
                str := str || lastname( mod(id/10,10) );
                str := str || lastname( mod(id,10) );
        end randlastname;

        function NURand (A in integer, x in integer, y in integer,
                        cnum in integer) return integer is
                ta binary_integer;
                tb binary_integer;
        begin
                ta := random.val(0,A+1);
                tb := random.val(x,y+1);
        end randnum;

        procedure randlastname (str out varchar2,id in integer) is
        begin
                id := mod(id,1000);
                str := lastname(id/10);
                str := str || lastname( mod(id/10,10) );
                str := str || lastname( mod(id,10) );
        end randlastname;

        function NURand (A in integer, x in integer, y in integer,
                        cnum in integer) return integer is
                ta binary_integer;
                tb binary_integer;
        begin
                ta := random.val(0,A+1);
                tb := random.val(x,y+1);
                return mod( (ta OR tb) + cnum, y - x + 1) + x;
        end NURand;

end tpccrand;
/
show errors;
------------ cut here -------------------------------

And the errors are : (sqlplus SYS/password)



SQL> @tpccrand.pls

Warning: Package created with compilation errors.

        type Tperm is varray (3000) of integer;
                                         *
ERROR at line 3:
ORA-00942: table or view does not exist

No errors.

Warning: Package Body created with compilation errors.

                pos binary_integer;
                       *

ERROR at line 3:
ORA-00942: table or view does not exist

No errors.


Thanks a lot to people will be able to help me ! Received on Thu May 27 1999 - 09:40:39 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US