Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Include Column Headings with Query Results

Status
Not open for further replies.

TXP007

Programmer
Aug 29, 2008
11
US
The following subquery successfully identifies duplicate description table entries in an Oracle database. The result of this query is automatically transferred to the business functional team (customer) for them to fix through the front end application (Oracle EBS).

SQL:
Select apps.ffvvo.flex_value, apps.ffvvo.description, apps.ffvso.flex_value_set_name, apps.ffvvo.summary_flag, apps.ffvvo.enabled_flag
From apps.fnd_flex_values_vl ffvvo left outer join apps.fnd_flex_value_sets ffvso on apps.ffvvo.flex_value_set_id = apps.ffvso.flex_value_set_id
Where apps.ffvvo.flex_value != 'T' and apps.ffvvo.Description in (
                      Select apps.ffvv.Description
                      from apps.fnd_flex_values_vl ffvv left outer join apps.fnd_flex_value_sets ffvs on apps.ffvv.flex_value_set_id = apps.ffvs.flex_value_set_id
                      where apps.ffvs.flex_value_set_name in ('CTPA_ACCOUNT','CTPA_ACTIVITY','CTPA_CENTER','CTPA_FUND','CTPA_FUTURE','CTPA_PROJECT')
                      Group by apps.ffvv.Description having count(ffvv.flex_value) > 1
                      )
Order By apps.ffvvo.description;

How can I display the column names in the results of this SQL subquery? My research suggests adding a UNION could be the solution; however, I am struggling trying to determine where to place the UNION in the subquery.

Along with the query results, the 5 coulumn names I want to display on the first line are 'FLEX_VALUE', 'DESCRIPTION', 'FLEX_VALUE_SET_NAME', 'SUMMARY_FLAG', and 'ENABLED_FLAG'.

Thank you for any assistance you can provide.
Tim
 
For the best answer to your question you might want to try the Oracle Forum.

Simi
 
Besides posting in the right forum, with any database there is good reasoning for headings versus technical field names and just because your customer is illiterate in one or the other way about this, there is no good reason to put the results into fields with the field headings. Why not simply - for once and all - give them a list of fields and field headings to map to.

Field names are not data and if you would want them as first record of your resultset, all fields would need to be character, which is not the intention of a data table, you rather have schema (list of field names or captions) aside of the pure data. Putting data into csv files adds the field names as first line of the csv file in some databases or tools, anyway, so these names don't need to be part of the data, anyway it would be a bad practice to put the field names or headings into the data itself, because that only solves the problem of writing a first line to introduce new problems, in losing accuracy or encoding or anything else by converting all data to text. It's a problem of CSV or XML as data exchange format anyway.

I'd suggest you create a table, maybe even a database and put all data in there for further processing, then transfer this full database in it's binary form to continue to work on in Oracle.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top