Re: Q: having problem when define a table type in PL/SQL

From: Hartlieb WILD <whsysana_at_ping.at>
Date: 1996/04/04
Message-ID: <N.040496.120346.45_at_ping.at>#1/1


Dear Dawei Chang,

I tried to solve your problem. First of all it should read "INDEX" and not "INDEXED".
But I could run this only with SQL*plus. Ths script reads like the following and works properly (please don't mind the German comments ...):

DROP TABLE test00 ;
CREATE TABLE test00 (zahl NUMBER) ;

/* PL / SQL-Block */
DECLARE
/* TYPE definieren */

   TYPE table_type IS TABLE OF number

        INDEX BY BINARY_INTEGER ;
/* Variable NUMMERN als TYPE deklarieren */
   nummern table_type ;
/* Laufindex dazu */

   i BINARY_INTEGER := 0 ;
BEGIN
/* NUMMERN initialisieren */

   FOR i IN 1..10 LOOP

      nummern (i) := i * i ;
   END LOOP ;    FOR i IN 1..10 LOOP

      INSERT INTO test00 VALUES (nummern (i)) ;    END LOOP ;
END;
/

/* Anzeige */
SELECT * FROM test00 ;



I just need the auxiliary table TEST00 to check the contents of the table in the PL/SQL block. - The result:

PL/SQL procedure successfully completed.

     ZAHL


        1
        4
..
       81
      100

10 rows selected.


BUT - if I try to run this script with the ORACLE Procedure Builder exactly the error message occurres you described.

I don't have any explanation - did you get an in the meanwhile? I'd be very interested.

Sincerely,
H. WILD

+==========================================================================+
| Hartlieb  WILD        Systemanalyse    Programmierung     EDV-Training   |
|                     allgemein beeideter gerichtlicher Sachverständiger   |
|                                                                          |
| A-6073 SISTRANS 280   e-mail:  whsysana_at_ping.at     Tel.: (++43) (0)512  |
| Austria               CompuServe:   100131,1552                 378 110  |
+==========================================================================+


> Hi group, I am having a problem when try to define a table type in
> PL/SQL. The code fragment is as follows:
>   
>   TYPE table_type IS TABLE OF  number INDEXED BY BINARY_INTEGER;
> 
>   error message:
>   Encountered the symbol "OF" when expecting one of the following "[" 
>   Fatal syntax error unable to recover.
> 
> I am using FORM 4.5 on a window 3.1 system. Lots of thanks.
> 
> ----------
> dawei chang

> dawei_at_wam.umd.edu
> 3/30/96 Received on Thu Apr 04 1996 - 00:00:00 CEST

Original text of this message