Home » SQL & PL/SQL » SQL & PL/SQL » show selected columns only
show selected columns only [message #225545] Tue, 20 March 2007 05:15 Go to next message
aankha
Messages: 8
Registered: January 2007
Location: Nepal
Junior Member
I have to create a report that shows only a selected columns that are selected according to the substring of the column name at the end. I know that I can find the names of the columns with the query
"select column_name from all_tab_columns where table_name = 'table' an column_name like '%_INT' " where the INT is the end substring.

How do I get these columns only in the data output?
Re: show selected columns only [message #225552 is a reply to message #225545] Tue, 20 March 2007 05:40 Go to previous messageGo to next message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I believe you'll have to name every one of them in the column list:
SELECT a_int, b_int, c_int FROM some_table


Perhaps there is a way to include all of them using some kind of a wildcard feature
SELECT %_int FROM some_table
but I don't know anything about it.
Re: show selected columns only [message #225559 is a reply to message #225545] Tue, 20 March 2007 06:13 Go to previous message
martijn
Messages: 283
Registered: December 2006
Location: Netherlands
Senior Member
You probably need some dynamic-sql to do this.

Search on the forum for "dynamic sql" and/or "dbms_sql" and/or "execute immediate"

This will probably supply you with some examples, you can alter to fit your needs.
Previous Topic: Sending data to fax server
Next Topic: procedure / package
Goto Forum:
  


Current Time: Sat Dec 10 16:39:37 CST 2016

Total time taken to generate the page: 0.03937 seconds