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 -> Re: Arrays in Oracle 7.1.6 for UNIX

Re: Arrays in Oracle 7.1.6 for UNIX

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Tue, 21 Jul 1998 15:52:01 GMT
Message-ID: <35b7b87e.11098148@192.86.155.100>


A copy of this was sent to jhsieh_at_my-dejanews.com (if that email address didn't require changing) On Tue, 21 Jul 1998 14:17:38 GMT, you wrote:

>Currently I have written a PL/SQL-code on Oracle Server 7.3.2.
>
>I am trying to retrieve the number of elements in an array:
> i_count := myarray.count;
>this code works fine in Oracle 7.3.2 but I need to run the same code on Oracle
>7.1.6, which apparently does not understand this line of code.
>

thats a new feature in 7.3 (.count)...

If the 'array' starts at some known value and the elements in the array are contigous (eg: you always start at 1 and if the array has 10 elements then 1, 2, 3, 4, 5, 6, 7, 8, 9 and 10 are all valid subscripts) then the following loop will 'count' your array:

   l_cnt := 0;
   for i in 1 .. 1000000 loop
   begin

       if ( myarray(i) is not null ) then null; end;
       l_cnt := l_cnt+1;
   exception
       when no_data_found then exit;

   end;
   end loop;

l_cnt now has the number of elements in the table (as long as you have less then 1000000 of them anyway..)

>Does anyone know how to solve this problem in 7.1.6 or how to get around it.
>I just need to find out the number of elements in an array.
>
>Thank you.
>
>Jamie
>
>-----== Posted via Deja News, The Leader in Internet Discussion ==-----
>http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
 

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Herndon VA  

http://govt.us.oracle.com/ -- downloadable utilities  



Opinions are mine and do not necessarily reflect those of Oracle Corporation  

Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Tue Jul 21 1998 - 10:52:01 CDT

Original text of this message

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