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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Arrays in PL/SQL?

Re: Arrays in PL/SQL?

From: Simon Morley <morleys_at_entcf2.agw.bt.co.uk>
Date: 1997/07/31
Message-ID: <33e0a8f3.200227151@news.axion.bt.co.uk>#1/1

On Thu, 31 Jul 1997 08:48:44 GMT, "Steven H." <steven_at_hovington.demon.co.uk> wrote:

>Could anyone tell me if Oracle PL/SQL supports
>array type variables? Thanks in advance.
>
>Steven Hovington.

You can emulate an array using a PL/SQL table. You have to declare a table type to hold elements you want, then declare a variable of this type.

eg

declare

type mytabletype is table of varchar2(10)

        index by binary integer;

myvariable mytabletype;

PL/SQL tables have an attribute called count which you can use to traverse the rows similar to an array.

e.g.

begin

	for i in 1 .. myvariable.count
	loop
		x := myvariable(i);

	end loop;

I think this should do what you want.

regards,

Simon. Received on Thu Jul 31 1997 - 00:00:00 CDT

Original text of this message

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