Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

oracle pivot column names with embeddded spaces

Posted on 2011-09-27
2
Medium Priority
?
1,091 Views
Last Modified: 2012-06-22
I am pivoting an oracle view on a certain column. The values in this column may contain embedded spaces. I can get the column names to pivot ok if I surround them with single quotes, however, they then appear in the result with the quotes! Is there any way to get the pivoted column values/names to appear without the quotes? Assume it would not be possible to change the values in the pivoted column to eliminate the blanks.

I have attached a screen image that shows what I mean. pivot table
0
Comment
Question by:bassman592
2 Comments
 
LVL 74

Accepted Solution

by:
sdstuber earned 2000 total points
ID: 36710347
for metric in ('PATS' as "PATS", 'PATS Ratio' as "PATS Ratio", 'TRX' as "TRX", 'TRX Ratio' as "TRX Ratio")
0
 

Author Closing Comment

by:bassman592
ID: 36710411
Beautiful! Thank you.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question