|
|
|
|
|
|
|
|
|
|
| Re: want data of all columns in a single column (no concatenate) [message #637284 is a reply to message #637277] |
Thu, 14 May 2015 07:28   |
Lalit Kumar B
Messages: 3174 Registered: May 2013 Location: World Wide on the Web
|
Senior Member |
|
|
@jgjeetu,
This will work only with your sample data, as ORDER BY on string will sort it based on the ASCII values. You need to take care of the order depending on the data. So, if you have alphanumeric data, you will need to sort each output in the UNION ALL and not on the entire result set. Using ORDER BY with UNION ALL applies it on the result set.
SQL> SELECT TO_CHAR(id) id FROM TEST
2 UNION ALL
3 SELECT val id FROM test ORDER BY id;
ID
----------------------------------------
1
2
3
4
5
A
B
C
D
E
10 rows selected.
SQL>
|
|
|
|
|
|
|
|