Re: HELP!! can't select with cursor!!

From: Carlos Netto <Carlos.Netto_at_ibase.org.br>
Date: Sun, 18 Sep 94 00:58:00 -0300
Message-ID: <2aa.511.846%mpcbbs_at_ibase.org.br>


On 18 Sep 94 07:22am, wrote to ALL:

> Newsgroup: comp.databases.oracle
> Organization: Computer Science Dept, University of Queensland
 

> I have a problem with select statements when using cursor.
> eg:
 

> DECLARE
> cursor c1 is select column_name from T1 where column_name in('A2',
> 'A3'); col varchar(5);
> ...
> BEGIN
> for c1rec in c1 LOOP
> col:= c1rec.column_name;
> insert into T2(column_value)
> select distinct &&col from T3 where A1=6;

                     ^^^^^^^ (*)

> end loop;
> END;
> /
>

(*) &&col is a lexical macro substitution. You need dynamic SQL. You're

   using a wrong feature.    

Good luck,


|  Carlos Augusto Leite Netto   | Voice  : +55.192.51.1153                  |
|  Software Design Informatica  | Fax    : +55.192.54.6518                  | 
|  Oracle VAR                   | e-mail : carlos.netto%mpcbbs_at_ibase.org.br |
|  Software Development & DBA   | FidoNet: 4:801/31 (Carlos Netto)          |
|---------------------------------------------------------------------------|
|  Softex 2000 member           | Brazil, Sao Paulo state, Campinas city    | 
=============================================================================
  • Evaluation copy of Silver Xpress. Day # 86 --- via Silver Xpress V4.01P [NR]

User Name: Carlos Netto - ( %mpcbbs_at_ibase.org.br ) This message was processed by RAuucp from Merlin Systems Inc.
Received on Sun Sep 18 1994 - 05:58:00 CEST

Original text of this message