Skip to Main Content

Breadcrumb

more

Connor and Chris don't just spend all day on AskTOM. You can also catch regular content via Connor's blog and Chris's blog. Or if video is more your thing, check out Connor's latest video and Chris's latest video from their Youtube channels. And of course, keep up to date with AskTOM via the official twitter account.

Question and Answer

Connor McDonald

Thanks for the question.

Asked: July 08, 2016 - 5:30 am UTC

Answered by: Connor McDonald - Last updated: July 08, 2016 - 6:06 am UTC

Category: Developer - Version: 11.0

Viewed 100+ times

Whilst you are here, check out some content from the AskTom team: Partitioning Guide updated

You Asked

How to create a table for this one.

AAA BBB CCC
RED 1 2 3
BLUE 4 5 6
GREEN 7 8 9

I tried on SQL DEVELOPER.It's gave me an error.

And converted into an out put like..

RED BLUE GREEN
AAA 1 4 7
BBB 2 5 8
CCC 3 6 9.........(For this we will use Listagg or Pivot Key word.)

SQL>SELECT LISTAGG(RED,BLUE,GREEN ', ') WITHIN GROUP (ORDER BY COLNAMES) "CONVERT"
FROM CNVT;

OR...By using Pivot_Key word.

Note:-which one is better to do a sol.

and we said...


AAA BBB CCC
RED 1 2 3
BLUE 4 5 6
GREEN 7 8 9

That looks to me like 3 column headings, and 4 column values in each row.

So I dont know what you are trying to achieve here.

Give us some *scripts* ... even if they dont work - at least then we can see what it is you are trying to achieve.

Is this answer out of date? If it is, please let us know via a Review