Dynamically build the column names for the SELECT query

From: Ajay Madan <ajay_madanNOajSPAM_at_usa.net.invalid>
Date: 2000/02/29
Message-ID: <13b2087d.3eb8866c_at_usw-ex0109-070.remarq.com>#1/1


My application is on Oracle8i/Developer6. The table I am accessing(thru the form, in one of the triggers) has 130 columns and I need to display only 3 of those columns on the form. These 3 columns are not fixed. It could be any of the 3 columns amongst the 130 columns based on some condition. All the columns have the same prefix, but only the suffix changes. For example the columns names are RQMT1, RQMT2..........RQMT130. Is it possible that I hardcode the 'RQMT' in the query and substitute 1 or 2 or any number based on whatever my conditions are.

   select RQMT&num,

	  RQMT&NUM1,
	  RQMT&NUM2

   INTO LOCAL_VARS    FROM
          TABLE_NAME
   WHERE <SOME CONDITION>

Or can you suggest some solution for dynamic building of the SQL statement?

  • Sent from AltaVista http://www.altavista.com Where you can also find related Web Pages, Images, Audios, Videos, News, and Shopping. Smart is Beautiful
Received on Tue Feb 29 2000 - 00:00:00 CET

Original text of this message