Home » SQL & PL/SQL » SQL & PL/SQL » Split column to rows in Oracle Sql
|
|
|
|
Re: Split column to rows in Oracle Sql [message #640137 is a reply to message #640132] |
Wed, 22 July 2015 23:56   |
Lalit Kumar B
Messages: 3174 Registered: May 2013 Location: World Wide on the Web
|
Senior Member |
|
|
jgjeetu wrote on Thu, 23 July 2015 10:13
for 10g & below versions use:-
select replace(columnname,',',chr(10)) from table;
How would that generate 3 rows? OP asked to split into rows:
Quote:I need to split the above Note into 3 rows as below.
SQL> WITH DATA AS(
2 SELECT '2252998,2252999,2253000' str FROM dual
3 )
4 SELECT count(*) FROM(
5 select replace(str,',',chr(10)) from data);
COUNT(*)
----------
1
SQL>
You are just replacing comma with Line feed and not generating rows.
|
|
|
|
|
|
|
|
|
Goto Forum:
Current Time: Sun Jun 08 20:31:01 CDT 2025
|