Rows into Columns in Oracle

Hi Team,
Convert rows into columns

hostname parameter             value
localhost    cpu_count             16
localhost    db_unique_name sams
localhost sga_max_size           34359738368
localhost sga_target                 30064771072
localhost shared_pool_size      2147483648

I want to display as
hostname  cpu_count  db_unique_name sga_max_size   sga_target         shared_pool_size
localhost     16                sams                       34359738368   30064771072   2147483648

I tried with decode does not work , because the column values are dynamic it keeps changing. Any help is really appreciated.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

slightwv (䄆 Netminder) Commented:
Not sure exactly what you are after but see if this is close:
with mydata as (
	select 'localhost' hostname, name parameter, value
	from v$parameter
	where name in (
select * from mydata
	pivot (
		max(value) value
		for parameter in (
			'cpu_count' as cpu_count,
			'db_unique_name' as db_unique_name,
			'sga_max_size' as sga_max_size,
			'sga_target' as sga_target,
			'shared_pool_size' as shared_pool_size

Open in new window

If you are trying to create dynamic columns at query time, you cannot with simple SQL.  You would need to write code to attempt that.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sam_2012Author Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.