Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Arrays in PL/SQL?
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
![]() |
![]() |