Select table column dynamically.

From: YyWong <yywong_at_math.hkbu.edu.hk>
Date: 1997/08/23
Message-ID: <5tlr8g$8hc$1_at_power42t.hkbu.edu.hk>#1/1


[Quoted] I want to write a PL/SQL to select values from a specified column. However, I don't know how can I do this. Can anyone help me?

The question is:

  Suppose I have a table TEST created as

     create table TEST
       (ID  NUMBER NOT NULL,
	A1  VARCHAR2(5) NULL,
	A2  VARCHAR2(5) NULL,
	A3  VARCHAR2(5) NULL);

  and I want to select the column 'A1', 'A2', 'A3' dynamically in   a PL/SQL procedure. Example,

     select A? from TEST;

  where ? represents a number 1, 2, or 3 which is assigned from the   program at runtime.

Is it possible to do this?

--
Received on Sat Aug 23 1997 - 00:00:00 CEST

Original text of this message