Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: PLSQL: Looping thru Variables
Your procedure is being passed the strins 'var1', 'var2' and 'var3'.
One way of doing this is to use a PL/SQL table to store the values
are then use it as an array.
To do this, declare a PL/SQL table to hold the values of var1 till varN.
TYPE CarNameType IS TABLE OF VARCHAR2 INDEX BY BINARY_INTEGER;
car_tab CarNameType;
car_tab(1) := 'CHEVY'; car_tab(2) := 'SATURN'; car_tab(3) := 'OLDS'; FOR i IN 1..3 LOOP foo(car_tab(i));
Hope this helps.
Gunjeet
In article 3987573_at_news.northgrum.com, mark_aurit_at_mail.northgrum.com (Mark Aurit) writes:
> I call a routine, passing it 3 variables: var1,var2,var3, which
> contain the values 'CHEVY','SATURN','OLDS' (actually, a lot more than
> 3 get passed).
>
> From that routine, I want to call another, passing it the values of
> the variables from within a loop, along the lines of:
>
> FOR i = 1..3 LOOP
> foo('var'||i);
> END LOOP;
>
> Foo() is receiving the values 'var1','var2','var3', and not
> 'CHEVY','SATURN','OLDS'.
>
> Any help would be greatly appreciated.
>
> Mark
> mark_aurit AT mail.northgrum.com
Received on Tue Aug 11 1998 - 13:53:29 CDT
![]() |
![]() |