Re: Can I do this A||1:= 100; in PLSQL.

From: Safeer <safeer_at_nettaxi.com>
Date: Wed, 29 Aug 2001 09:16:49 -0400
Message-ID: <9miq02$2fj38$1_at_ID-100405.news.dfncis.de>


Thanks a lot to all of you.

I was thinking about execute immidiate too, I know it is not very good solution but I need only these results.

Regards,

Muhammad Safeer.

"Thomas Kyte" <tkyte_at_us.oracle.com> wrote in message news:9mhfgn022jk_at_drn.newsguy.com...
> In article <eb00ec08.0108281312.77ed0dc9_at_posting.google.com>,
safeer_at_nettaxi.com
> says...
> >
> >I am just trying to do the following code, how can I do that in plsql,
> >I don't want to use array or PLSQL tables.
> >
> >declare
> >a1 number;
> >a2 number;
> >a3 number;
> >a4 number;
> >begin
> > for i in 1 .. 4
> > loop
> > a||i := i;
> > end loop;
> >end;
> >
> >Regards,
> >
> >Muhamamd Safeer.
>
>
> you cannot do that but you can do this:
>
> declare
> type numArray is table of number index by binary integer;
> a numArray;
> begin
> for i in 1 .. 4
> loop
> a(i) := i;
> end loop;
> end;
>
>
> You could also (but it wouldn't be a good thing) do this:
>
> create or replace package my_pkg
> as
> a1 number;
> a2 number;
> a3 number;
> a4 number;
> end;
> /
>
>
> begin
> for i in 1 .. 4
> loop
> execute immediate 'begin a' ||i || ' := :i; end;' using IN i;
> end loop;
> end;
>
> and set the global package variables.
>
> --
> Thomas Kyte (tkyte_at_us.oracle.com) http://asktom.oracle.com/
> Expert one on one Oracle, programming techniques and solutions for Oracle.
> http://www.amazon.com/exec/obidos/ASIN/1861004826/
> Opinions are mine and do not necessarily reflect those of Oracle Corp
>
Received on Wed Aug 29 2001 - 15:16:49 CEST

Original text of this message