PL/SQL-Tables and Integer-Indexes

From: Pascal Glauser <glauser_at_my-deja.com>
Date: Wed, 29 Dec 1999 22:53:02 GMT
Message-ID: <84e2pv$f5i$1_at_nnrp1.deja.com>



As loop-variables for PL/SQL-Tables I used vars of the datatype INTEGER:

declare
  Type TtabWords is Table of Varchar2(50) Index By Binary_Integer;   tabWords TtabWords ;
  i Integer ;
begin
  ... fill the elements 1 .. 35 of tabWords   for i in tabWords.FIRST .. tabWords.LAST loop     dbms_output.put_line(tabWords(i)) ;
  end loop ;
end ;
(Oracle 7.3.4.0.0 on Win NT)

I found it gave me (occasionally) a no_data_found-exception when referencing the 17th element. Because the error showed up only occasionally, I am not sure about the 17th element. However, after replacing the type of i by binary_integer, the error didn't happen any more.

Can anybody tell us

1) what happened
2) why the error occured only intermittently
3) why the compiler didn't produce an error nor a warning

I wonder if the rest of the oracle-programming world is aware of this.

Pascal Glauser

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Wed Dec 29 1999 - 23:53:02 CET

Original text of this message