Rows in comma (,) separated format
Hi all,
Let's consider that my EMP table has the following data:
EmpID DeptID
101 10
102 10
103 10
104 20
105 20
106 30
107 20
Now I need a query to get the result as:
DeptID Emps
10 101,102,103
20 104,105,107
30 106
Thanks in advance.
Edited by: Iniyavan on Sep 20, 2009 4:00 PM
Hi,
That's called String Aggregation . (Even if 101, 102, and 103 are numbers, '101,102,103' with the commas, is a string.)
[AskTom.oracle.com|http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:2196162600402] shows several different ways to do it.
For convenience, you can't beat the first solution on that page, a user-defined aggregate function clled STRAGG.
Once you have STRAGG installed (it can be copied verbatim from that page) it can be used over and over in queries like:
SELECT DeptID
, STRAGG (EmpID) AS Emps
FROM emp
GROUP BY DeptID;Unfortunately, STRAGG is not so good at ordered output.
If order is important, then use one of the other solutions, like SYS_CONNECT_BY_PATH, near the end of the page:
WITH got_r_num
SELECT DeptID
, EmpID
, ROW_NUMBER () OVER ( PARTITION BY DeptID
ORDER BY EmpID
) AS r_num
FROM emp
SELECT DeptID
, SUBSTR ( SYS_CONNECT_BY_PATH ( EmpID, ',')
, 2
) AS Emps
FROM got_r_num
WHERE CONNECT_BY_ISLEAF = 1
START WITH r_num = 1
CONNECT BY r_rnum = PRIOR r_num + 1
AND DeptID = PRIOR DeptID
;Sorry, I'm not at a database, so I can't test this.
Edited by: Frank Kulash on Sep 20, 2009 7:01 AM
Examples added
Similar Messages
-
How can i get all these values in single row with comma separated?
I have a table "abxx" with column "absg" Number(3)
which is having following rows
absg
1
3
56
232
43
436
23
677
545
367
xxxxxx No of rows
How can i get all these values in single row with comma separated?
Like
output_absg
1,3,56,232,43,436,23,677,545,367,..,..,...............
Can you send the query Plz!These all will do the same
create or replace type string_agg_type as object
2 (
3 total varchar2(4000),
4
5 static function
6 ODCIAggregateInitialize(sctx IN OUT string_agg_type )
7 return number,
8
9 member function
10 ODCIAggregateIterate(self IN OUT string_agg_type ,
11 value IN varchar2 )
12 return number,
13
14 member function
15 ODCIAggregateTerminate(self IN string_agg_type,
16 returnValue OUT varchar2,
17 flags IN number)
18 return number,
19
20 member function
21 ODCIAggregateMerge(self IN OUT string_agg_type,
22 ctx2 IN string_agg_type)
23 return number
24 );
25 /
create or replace type body string_agg_type
2 is
3
4 static function ODCIAggregateInitialize(sctx IN OUT string_agg_type)
5 return number
6 is
7 begin
8 sctx := string_agg_type( null );
9 return ODCIConst.Success;
10 end;
11
12 member function ODCIAggregateIterate(self IN OUT string_agg_type,
13 value IN varchar2 )
14 return number
15 is
16 begin
17 self.total := self.total || ',' || value;
18 return ODCIConst.Success;
19 end;
20
21 member function ODCIAggregateTerminate(self IN string_agg_type,
22 returnValue OUT varchar2,
23 flags IN number)
24 return number
25 is
26 begin
27 returnValue := ltrim(self.total,',');
28 return ODCIConst.Success;
29 end;
30
31 member function ODCIAggregateMerge(self IN OUT string_agg_type,
32 ctx2 IN string_agg_type)
33 return number
34 is
35 begin
36 self.total := self.total || ctx2.total;
37 return ODCIConst.Success;
38 end;
39
40
41 end;
42 /
Type body created.
[email protected]>
[email protected]> CREATE or replace
2 FUNCTION stragg(input varchar2 )
3 RETURN varchar2
4 PARALLEL_ENABLE AGGREGATE USING string_agg_type;
5 /
CREATE OR REPLACE FUNCTION get_employees (p_deptno in emp.deptno%TYPE)
RETURN VARCHAR2
IS
l_text VARCHAR2(32767) := NULL;
BEGIN
FOR cur_rec IN (SELECT ename FROM emp WHERE deptno = p_deptno) LOOP
l_text := l_text || ',' || cur_rec.ename;
END LOOP;
RETURN LTRIM(l_text, ',');
END;
SHOW ERRORS
The function can then be incorporated into a query as follows.
COLUMN employees FORMAT A50
SELECT deptno,
get_employees(deptno) AS employees
FROM emp
GROUP by deptno;
###########################################3
SELECT SUBSTR(STR,2) FROM
(SELECT SYS_CONNECT_BY_PATH(n,',')
STR ,LENGTH(SYS_CONNECT_BY_PATH(n,',')) LN
FROM
SELECT N,rownum rn from t )
CONNECT BY rn = PRIOR RN+1
ORDER BY LN desc )
WHERE ROWNUM=1
declare
str varchar2(32767);
begin
for i in (select sal from emp) loop
str:= str || i.sal ||',' ;
end loop;
dbms_output.put_line(str);
end;
COLUMN employees FORMAT A50
SELECT e.deptno,
get_employees(e.deptno) AS employees
FROM (SELECT DISTINCT deptno
FROM emp) e;
DEPTNO EMPLOYEES
10 CLARK,KING,MILLER
20 SMITH,JONES,SCOTT,ADAMS,FORD
30 ALLEN,WARD,MARTIN,BLAKE,TURNER,JAMES
CREATE OR REPLACE FUNCTION concatenate_list (p_cursor IN SYS_REFCURSOR)
RETURN VARCHAR2
IS
l_return VARCHAR2(32767);
l_temp VARCHAR2(32767);
BEGIN
LOOP
FETCH p_cursor
INTO l_temp;
EXIT WHEN p_cursor%NOTFOUND;
l_return := l_return || ',' || l_temp;
END LOOP;
RETURN LTRIM(l_return, ',');
END;
COLUMN employees FORMAT A50
SELECT e1.deptno,
concatenate_list(CURSOR(SELECT e2.ename FROM emp e2 WHERE e2.deptno = e1.deptno)) employees
FROM emp e1
GROUP BY e1.deptno;
DEPTNO EMPLOYEES
10 CLARK,KING,MILLER
20 SMITH,JONES,SCOTT,ADAMS,FORD
30 ALLEN,WARD,MARTIN,BLAKE,TURNER,JAMES
CREATE OR REPLACE TYPE t_string_agg AS OBJECT
g_string VARCHAR2(32767),
STATIC FUNCTION ODCIAggregateInitialize(sctx IN OUT t_string_agg)
RETURN NUMBER,
MEMBER FUNCTION ODCIAggregateIterate(self IN OUT t_string_agg,
value IN VARCHAR2 )
RETURN NUMBER,
MEMBER FUNCTION ODCIAggregateTerminate(self IN t_string_agg,
returnValue OUT VARCHAR2,
flags IN NUMBER)
RETURN NUMBER,
MEMBER FUNCTION ODCIAggregateMerge(self IN OUT t_string_agg,
ctx2 IN t_string_agg)
RETURN NUMBER
SHOW ERRORS
CREATE OR REPLACE TYPE BODY t_string_agg IS
STATIC FUNCTION ODCIAggregateInitialize(sctx IN OUT t_string_agg)
RETURN NUMBER IS
BEGIN
sctx := t_string_agg(NULL);
RETURN ODCIConst.Success;
END;
MEMBER FUNCTION ODCIAggregateIterate(self IN OUT t_string_agg,
value IN VARCHAR2 )
RETURN NUMBER IS
BEGIN
SELF.g_string := self.g_string || ',' || value;
RETURN ODCIConst.Success;
END;
MEMBER FUNCTION ODCIAggregateTerminate(self IN t_string_agg,
returnValue OUT VARCHAR2,
flags IN NUMBER)
RETURN NUMBER IS
BEGIN
returnValue := RTRIM(LTRIM(SELF.g_string, ','), ',');
RETURN ODCIConst.Success;
END;
MEMBER FUNCTION ODCIAggregateMerge(self IN OUT t_string_agg,
ctx2 IN t_string_agg)
RETURN NUMBER IS
BEGIN
SELF.g_string := SELF.g_string || ',' || ctx2.g_string;
RETURN ODCIConst.Success;
END;
END;
SHOW ERRORS
CREATE OR REPLACE FUNCTION string_agg (p_input VARCHAR2)
RETURN VARCHAR2
PARALLEL_ENABLE AGGREGATE USING t_string_agg;
/ -
How to generate oracle report output in a comma separated format in reports
Pls any one can help in generation of oracle report in comma separated format in reports 10g.....
thanks,
prasad.
1,Chennai,Nokiasiemen,Convent junction,5535Use desformat=delimited.
http://download.oracle.com/docs/cd/E15523_01/bi.1111/b32122/orbr_howto007.htm#i1040102 -
Need to have comma separated format
Hi all
I have developed a code in which is a file is stored in application server. The text in the file is continous without any space. I need to have text in comma separated format.
Plz help. Its urgent.
Regrds
MonaHi,
Following report tis the sample report for your requirement.
*Reading and Writing a text file from and to the application server*
* sy-subrc = 0 Record read from file
* sy-subrc = 4 End of file reached
data: w_dataset1(27) value '/var/textfile.txt',
w_dataset2(27) value '/var/outfile.txt'.
data:begin of itab1 occurs 0, "Text file format
matnr(18), "MATERIAL NUMBER
bwkrs(4), "PLANT
end of itab1.
*Uploading of text file from Application server.
open dataset w_dataset1 for input in text mode.
do.
if sy-subrc <> 0.
exit.
endif.
read dataset w_dataset1 into itab1.
append itab1.
clear itab1.
enddo.
close dataset w_dataset1.
*Downloading of text file to Application server.
open dataset w_dataset2 for output in text mode.
loop at itable.
transfer itable to w_dataset2.
endloop.
close dataset w_dataset2.
Thanks,
Sankar M -
Convert work area data into comma separator format ( CSV format )
the function moudule sap_convert_to_csv_format is not available in my system . it is a not released fm as of now. so i cant use it.
My requirement is to send the details to app server in a comma separated format.
For each work area , which i transfer to application server, i hv to separte each field by a comma separtaor.
TRANSFER wa to VA_FILENAME LENGTH 256 ENF OF LINE.
Suppose my work area has fields wa-f1 wa-f2 wa-f3, it should write in app server as value1, value2, value3 like wise....
Suggest me if there is any alternative function module to acheiver this like when we pass wa to fm, the fields should be comma separator,
Any other useful suggestions are welcome.
ThanksHi,
here is the piece of code to transfer data from internal table to applivcation server as a comma seperated file..
FORM comma_sep_file .
DATA: l_cost_center_str TYPE type_cost_center.
IF it_cost_center[] IS NOT INITIAL.
**Concatenate file path and file name
CONCATENATE p_cpath p_cfile INTO v_cost_cen_output.
OPEN DATASET v_cost_cen_output FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
If Network file could not be opened, give a message.
IF sy-subrc <> 0.
WRITE : / text-030 , v_cost_cen_output .
MESSAGE s000(zp) WITH text-015 .
CLEAR : v_cost_cen_output,
p_cpath .
ELSE.
LOOP AT it_cost_center INTO l_cost_center_str.
CONCATENATE l_cost_center_str-co_cen_code
l_cost_center_str-co_cen_name
l_cost_center_str-fld3
l_cost_center_str-fld4
l_cost_center_str-set_true INTO wa_csvdata
SEPARATED BY c_const_sep.
TRANSFER wa_csvdata TO v_cost_cen_output.
CLEAR wa_csvdata.
ENDLOOP.
ENDIF."IF sy-subrc <> 0.
CLOSE DATASET v_cost_cen_output.
ENDIF.
ENDFORM. "
i hope this will help you...
Thanks & Regards
Ashu Singh -
Rows into comma separated values
DB version : 11.2
I would like get rows into comma separated values
expected output
rowvalue1,<space>rowvalue2,<space>rowvalue3,<space>rowvalue4,.....Example:
create table test1 (name1 varchar2(10));
insert into test1 values ('JOHN');
insert into test1 values ('YING');
insert into test1 values ('KAREN');
insert into test1 values ('PEDRO');
commit;
SQL> select * from test1;
NAME1
JOHN
YING
KAREN
PEDROHow can I get this to printed as
JOHN, YING, KAREN, PEDROAssuming you want them in no particular order
SQL> select listagg(name1, ',') within group (order by rowid) from test1;
LISTAGG(NAME1,',')WITHINGROUP(
JOHN,YING,KAREN,PEDRO -
Combine data from a table and insert to another in comma separated format
In my SQL database table i have some data as shown below.
KNO Course Grade Institution
124 BTECH First IIT Calicut
128 BE First KKS Institute
124 CCNA Q NIIT Delhi
124 DDCN Q Appl Calicut
128 DIT A NIIT Delhi
128 VB Q IICM Delhi
i want this courses to be arranged as sample given under to a table named mainpers
KNO Course
124 BTECH[First], CCNA[Q],DDCN[Q]
128 BE[First], DIT[A], VB[Q]
I am a System Administrator at VadodaraYou can do this in SQL.
with cte as (
select distinct KNO
from Table1
select KNO
, Stuff(
(select ',' + Course + '[' + Grade + ']'
from Table1
where Table1.KNO = cte.KNO
for xml path ('')
), 1, 1, '') as Course
from cte
http://davidduffett.net/post/5334646215/get-a-comma-separated-list-of-values-in-sql-with-for
Russel Loski, MCT, MCSE Data Platform/Business Intelligence. Twitter: @sqlmovers; blog: www.sqlmovers.com -
Comma separated format is required
Hi all
this is the code which i have written:
OPEN DATASET g_ufile FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
LOOP AT t_file WHERE werks = t_file1-werks.
MOVE : gc_kaganplntcode TO t_file-fieldname1,
gc_productcode TO t_file-fieldname2,
gc_qtyavailable TO t_file-fieldname3.
CONCATENATE t_file-fieldname1
t_file-fieldname2
t_file-fieldname3
INTO gv_itemdet1 separated by ','.
ENDLOOP.
transfer gv_itemdet1 to g_ufile.
loop at t_file into t_file1.
condense t_file1 no-gaps.
transfer t_file1 to g_ufile.
append t_file1.
clear t_file1.
clear gv_itemdet.
endloop.
in t_file1 data is coming in continous manner. i need to have comma separated data. ie each field shud be separated by ','.
can anybody tell me logic for it.
very urgent.
regrd
Mona
Edited by: Alvaro Tejada Galindo on Apr 14, 2008 1:03 PMTry it this way mona
Declare a fiel-symbol type any and an string to tranfer the contents.
loop at t_file into t_file1.
clear string.
condense t_file1 no-gaps.
do.
assign component sy-index of structure t_file1 to <fs>.
if sy-subrc ne 0.
exit.
endif.
concatenate string <fs> ',' into string.
enddo.
transfer string to g_ufile.
append t_file1.
clear t_file1.
clear gv_itemdet.
endloop. -
How to convert result rows into comma separated values
hi,
Version
BANNER
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
PL/SQL Release 11.1.0.7.0 - Production
CORE 11.1.0.7.0 Production
TNS for Linux: Version 11.1.0.7.0 - Production
NLSRTL Version 11.1.0.7.0 - ProductionQuery
Select distinct prcdr_code from procedure p where P.PRCDR_CTGRY_LKPCD='P' ;
Output
PRCDR_CODE
0001F
0001T
0002F
0002T
0003F
0003T
0004F
0005F
0005T
0006F
0006T
0007F
0007T
0008F
0008T
0009F
0009T
000VA
000VG
Desired Output
0001F,0001T,0002F,0002T .................
My work
i tried this .....
Select distinct wm_concat(prcdr_code) as re from procedure p where P.PRCDR_CTGRY_LKPCD='P' ;
But i got ORA-22813: operand value exceeds system limits error
Please help me ..Thanks,
P Prakash
Edited by: prakash on Jan 4, 2012 9:05 AMAggregating CLOB's....
user defined aggregate function can do it...
create or replace type clobagg_type as object
text clob,
static function ODCIAggregateInitialize(sctx in out clobagg_type) return number,
member function ODCIAggregateIterate(self in out clobagg_type, value in clob) return number,
member function ODCIAggregateTerminate(self in clobagg_type, returnvalue out clob, flags in number) return number,
member function ODCIAggregateMerge(self in out clobagg_type, ctx2 in clobagg_type) return number
create or replace type body clobagg_type is
static function ODCIAggregateInitialize(sctx in out clobagg_type) return number is
begin
sctx := clobagg_type(null) ;
return ODCIConst.Success ;
end;
member function ODCIAggregateIterate(self in out clobagg_type, value in clob) return number is
begin
self.text := self.text || value ;
return ODCIConst.Success;
end;
member function ODCIAggregateTerminate(self in clobagg_type, returnvalue out clob, flags in number) return number is
begin
returnValue := self.text;
return ODCIConst.Success;
end;
member function ODCIAggregateMerge(self in out clobagg_type, ctx2 in clobagg_type) return number is
begin
self.text := self.text || ctx2.text;
return ODCIConst.Success;
end;
end;
create or replace function clobagg(input clob) return clob
deterministic
parallel_enable
aggregate using clobagg_type;
SQL> select trim(',' from clobagg(ename||',')) as enames from emp;
ENAMES
SMITH,ALLEN,WARD,JONES,MARTIN,BLAKE,CLARK,SCOTT,KING,TURNER,ADAMS,JAMES,FORD,MILLER
SQL> ed
Wrote file afiedt.buf
1 with t as
2 (select 'PFL' c1, 0 c2,110 c3 from dual union all
3 select 'LHL', 0 ,111 from dual union all
4 select 'PHL', 1, 111 from dual union all
5 select 'CHL', 2, 111 from dual union all
6 select 'DHL', 0, 112 from dual union all
7 select 'VHL', 1, 112 from dual union all
8 select 'CPHL', 0, 114 from dual union all
9 select 'WDCL', 1, 114 from dual union all
10 select 'AHL' ,2 ,114 from dual union all
11 select 'NFDL', 3, 114 from dual)
12 --
13 -- end of test data
14 --
15 select trim(clobagg(c1||' ')) as c1, c3
16 from (select * from t order by c3, c2)
17 group by c3
18* order by c3
SQL> /
C1 C3
PFL 110
LHL CHL PHL 111
DHL VHL 112
CPHL AHL NFDL WDCL 114 -
I have a requirement to take a String column that allows multiple fields i.e. "101;102,103,104",
and using a SPD 2013 workflow I want to split there values and then insert each Values into different list as separate items.
Eg:
I have a LIST A with the columns CustID, CustName and LIST B with the same Column Name with the below values
LIST A:
Cust ID
CustName
101
ABC, XYZ, CTSS, WIPROS, TCSS
I want to insert the above comma separated values in the below format(different Row)
LIST B:
CustID
CustName
101
ABC
101
XYZ
101
CTSS
101
WIPROS
101
TCSSHi,
Here is a codeplex solution can meet your reference:
Plumsail String Workflow Actions for SharePoint 2013 and SharePoint Online
http://spworkflowactions.codeplex.com/
We can use Split string workflow action to split the CustName value, then insert it to ListB.
More information:
http://www.codeproject.com/Articles/749471/String-processing-workflow-actions-for-SharePoint
Best Regards
Dennis Guo
TechNet Community Support -
Need to Convert Comma separated data in a column into individual rows from
Hi,
I need to Convert Comma separated data in a column into individual rows from a table.
Eg: JOB1 SMITH,ALLEN,WARD,JONES
OUTPUT required ;-
JOB1 SMITH
JOB1 ALLEN
JOB1 WARD
JOB1 JONES
Got a solution using Oracle provided regexp_substr function, which comes handy for this scenario.
But I need to use a database independent solution
Thanks in advance for your valuable inputs.
GeorgeGo for ETL solution. There are couple of ways to implement.
If helps mark -
File need to be read in different formats( Tab formatted, commas separated)
Hi All,
I am reading an input text file which can be in any of the format like tab formatted, commas separated or fixed format. How can i write a code to make it work for all these file format other than writing separately for the above three cases. Kindly suggest.
Thanks,
Neslin.As far as seperators are concerned you may read entire file to stirng table, then identify separator (i.e. if you find tab mark, you assume it is tab separated; if you find ";" mark you assume this is a column separator). Use SEARCH or FIND statement and then (after having the separator) loop at string table and split each entry at this separator. If none of the above was find (no separator or fixed one) split according to given fixed format.
-
Result may contain single string or comma separated need to split into rows
Hi, All... I've searched through the forums and found plenty on splitting comma separated into rows; though I'm struggling applying it to my situation. I have data that looks like the below where I need to split a value into multiple rows if it should be but the same field in the table may also contain a string that should not be separated (indicated by the "Array" field being 0 or 1)...
WITH t AS
(SELECT 1 as array, '"Banana", "Apple", "Pear"' as str FROM dual union all
SELECT 0, 'Fruit is delicious' FROM dual union all
SELECT 0, 'So are vegetables' FROM dual union all
SELECT 1, '"Bean", "Carrot", "Broccoli"' FROM dual union all
SELECT 1, '"Apple", "Banana"' FROM dual)I've looked through many of the connect_by posts on the forum and I haven't come across one that splits a field if it should be but doesn't if it should not be... may have missed it because there are plenty of these requests on the forum!
If you're feeling even more ambitious - the ultimate goal is to count the number of times a particular answer appears in an array - so notice the last portion of the data contains "Apple", "Banana"... the result would show:
RESULT
Banana 2
Apple 2
Pear 1
Bean 1
Carrot 1
Broccoli 1
Fruit is delicious
So are vegetablesI can always sort them later based on other fields in the table - but the result above would be my ultimate goal!
Any help is always appreciated. Thanks! 11gHi,
The examples you found should work for you. Just use a CASE expression to determine if str needs to be split or not, by looking at array.
Here's one way:
WITH got_part_cnt AS
SELECT array, str
, CASE
WHEN array = 0
THEN 1
-- ELSE 1 + REGEXP_COUNT (str, '", "') -- See note below
ELSE 1 + ( ( LENGTH (str)
- LENGTH (REPLACE (str, '", "'))
/ 4
END AS part_cnt
FROM t
, cntr AS
SELECT LEVEL AS n
FROM (
SELECT MAX (part_cnt) AS max_part_cnt
FROM got_part_cnt
CONNECT BY LEVEL <= max_part_cnt
, got_sub_str AS
SELECT CASE
WHEN p.array = 0
THEN p.str
ELSE REGEXP_SUBSTR ( p.str
, '[^"]+'
, 1
, (2 * c.n) - 1
END AS sub_str
FROM got_part_cnt p
JOIN cntr c ON c.n <= p.part_cnt
SELECT sub_str
, COUNT (*) AS cnt
FROM got_sub_str
GROUP BY sub_str
ORDER BY cnt DESC
, sub_str
{code}
The only database at hand right now is Oracle 10.2, which doesn't have REGEXP_COUNT. I had to use a complicated way of counting how many times '", "' occurs in str in order to test this in Oracle 10. Since you have Oracle 11, you can un-comment the line that uses REGEXP_COUNT in the first CASE expression, and remove the alternate ELSE clause (that is, the next 5 lines, up to END).
To make sure that this query is really paying attention to array, I added this row to the sample data:
{code}
SELECT 0, '"Bean", "Carrot", "Broccoli"' FROM dual union all
{code}
Even though str looks just like a delimited list, array=0 tells the query not to split it, so it produces these results:
{code}
SUB_STR CNT
Apple 2
Banana 2
"Bean", "Carrot", "Broccoli" 1
Bean 1
Broccoli 1
Carrot 1
Fruit is delicious 1
Pear 1
So are vegetables 1
{code} -
Comma separated column into rows for each value
experts,
I have a two column table. The second column has comma separated string values. How can I put the values separate for each comma separated and make one row for each value?
example,
column1 | StringColumn
s1 | test, joy, happy
s2 | USA, England, India
I want the result to be like below
column1 | StringColumn
s1 | test
s1 | joy
s1 | happy
s2 | USA
s2 | England
s2 | India
thanks in advance
ebroHello ebro,
See the following for a possible solution:
http://gallery.technet.microsoft.com/scriptcenter/Convert-Small-CSV-Value-to-ffc142ff
Olaf Helper
[ Blog] [ Xing] [ MVP] -
Convert comma separated string in rows
Dear Gurus,
I want to convert comma separated string in rows so as to insert in collection.
e.g. string 1234,2323,23232,2343,34234
Above string should be converted in rows so as to insert in table or collection
Thanks in advance
SanjeevOr slight variation...
SQL> ed
Wrote file afiedt.buf
1 with t as (select '1234,2323,23232,2343,34234' as txt from dual)
2 --
3 select REGEXP_SUBSTR (txt, '[^,]+', 1, level)
4 from t
5* connect by REGEXP_SUBSTR (txt, '[^,]+', 1, level) is not null
6 /
REGEXP_SUBSTR(TXT,'[^,]+',
1234
2323
23232
2343
34234... so it doesn't have to work out how many levels it needs to do, it just keeps going until it get's a no-value (of course that assumes that there is always a value between each comma)
Maybe you are looking for
-
GRC AC 10.1: Authorizaion Sync Job Error
Hello Everyone, I'm currently configuring my GRC 10.1 Access Control, I have just finished my common configuration tasks and ran the initial Authorization full sync job. and am facing the below error message. Authorization Sync Starting authorization
-
I have an i book G-4 i bought in dec 2005 it is running very slow.someone said defrag it? i have this thing called tech tool deluxe but it only says thing's that i dont know what they mean.what can i do to make as fast as it used to be at least? stua
-
How to send XML files through Business Connector to client URL
Dear ALL I am new to SAP BC. We have setup BC 4.8 and would like to send out a XML file from BC to Client URL. Could someone please guide me. Please suggest solutions. Thanks Ahmed
-
Hi there, I have been having this issue for quite awhile now. I am trying to pdf reader spreads and I can get it to go to the PDF printer window and it looks like it's working and it says opening in distiller and then it looks like it finishes, but I
-
Can i use multiple dvi monitors on the 2012 macbook pro (non-retina)?
What is the best way to connect two Dell DVI monitors I already have with my new 15" MBP (non-retina)?