Home » SQL & PL/SQL » SQL & PL/SQL » Dynamic SQL
Dynamic SQL [message #278663] Mon, 05 November 2007 06:01 Go to next message
mannem.sainath
Messages: 1
Registered: July 2007
Location: India
Junior Member

Hi All,

My requirement is to display no of columns based on the content of the same row column value,
for e.g., if colmn x value " based on this 22 value i need diplay columns x22,x23,to x29 in the same row
if colmn x value # based on this 22 value i need diplay columns x23,x24,to x29 in the same row
is it possible in SQL?

Thanks in advance,
Sainath
Re: Dynamic SQL [message #278666 is a reply to message #278663] Mon, 05 November 2007 06:06 Go to previous message
ThomasG
Messages: 3189
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
As long as the datatypes are the same, it could be done with decode or case statements.

Like

select a,
       b,
       decode(x,22,x22,23,x23),
from ....
Previous Topic: Sqlplus and the @ sign
Next Topic: query.....
Goto Forum:
  


Current Time: Sun Dec 04 18:38:31 CST 2016

Total time taken to generate the page: 0.09197 seconds