value of multiple line in a single row (nclob)
HelloI have a requirement where I have to work on a nclob data type column, now here the value of 2 lines in a single column. Like this:
Select extractvalue (xmltype (details), '/ Anything/invoiceNumber') separate as invoices,
actinguserid as user_id, createdt
of bchistevent where bucket = 201301
and upper (type) = ' COM. AVOLENT. PRESENTATION. EVENT. INVOICEDOWNLOADEVENT'
- and bchistevent.bucket = to_char (add_months (sysdate-1), "YYYYMM")
000-395452969-20130103 1.46388193452398E37 08/01/2013 03:05:42
300000590-000-20090723 1.46388193452398E37 11/01/2013 08:11:45
300000590-000-20090723 1.46388193452398E37 11/01/2013 08:12:50
000-395453127-20130103 1.46388193452398E37 14/01/2013 04:44:26
* 300084670-000-20120906, 300084671-000-20120906 * 1.46388193452398E37 07/01/2013 12:45:19 AM
000-395452626-20130103 1.46388193452398E37 08/01/2013 03:03:57
000-300084679-20120906-1.46388193452398E37 11/01/2013 08:10:47
300000728-000-20090731 1.46388193452398E37 11/01/2013 08:19:19
000-300084679-20120906 1.46388193452398E37 14/01/2013 12:31:48 AM
300000590-000-20090723 1.46388193452398E37 14/01/2013 04:13:19
000-395452718-20130103 1.46388193452398E37 08/01/2013 07:10:19
000-300084679-20120906 1.46388193452398E37 23/01/2013 06:54:11
000-300084679-20120906 1.46388193452398E37 22/01/2013 03:11:54
300000590-000-20090723 1.46388193452398E37 11/01/2013 08:14:02
000-395453127-20130103 1.46388193452398E37 14/01/2013 04:33:12
000-300084679-20120906 1.46388193452398E37 22/01/2013 03:03:36
000-300084679-20120906 1.46388193452398E37 14/01/2013 12:34:13 AM
000-395452997-20130103 1.46388193452398E37 07/01/2013 03:31:38
000-395452391-20121027 1.46388193452398E37 03/01/2013 04:40:05
and the value of the "BOLD" highlighted line is coming in a single line, please help how to break this in 2 rows?
Published by: user1175303 on March 13, 2013 05:43
user1175303 wrote:
the value of the column that is involved ishere I get 2 values in a single column, and for this reason, I am unable to get the desired result. 300084670-000-20120906, 300084671-000-20120906
If you have XML question but try to solve in Oracle? Why
SY.
with t as (
select distinct extractvalue(xmltype(details),'/Anything/invoiceNumber') as invoices,
actinguserid as user_id,
createdt
from bchistevent
where bucket = 201301
and upper(type) = 'COM.AVOLENT.PRESENTATION.EVENT.INVOICEDOWNLOADEVENT'
)
select regexp_substr(invoices,'[^,]+',1,column_value) invoices,
user_id,
createdt
from t,
table(
cast(
multiset(
select level
from dual
connect by level <= length(regexp_replace(invoices,'[^,]')) + 1
)
as sys.OdciNumberList
)
)
/
Tags: Database
Similar Questions
-
Convert multiple lines in a single value separated by commas
Is is possible to convert multiple lines in a single value by concatenating the value of each line in OBIEE. I think that IO had seem a blog related to this by I'm not able to find him. Essentially, here's what I would do:
Number of customer location
101
101 NY
101 PA
102 TX
102 CA
This is to convert
101. HE, NY, PA
102 TX, CA
Can you get it someone please let me know if this is possible and how to operate it.
Thanks in advance for the help.You can do this by creating a DB function,
Visit this link
Re: Display of the horizontal valuesThank you
Vino -
How to insert multiple lines using a single query
Hi all
How to insert multiple lines using a single query to the emp table?
I have the number of rows to insert into table x. consumes a lot of time. I tried to insert several lines using a single query, but get errors. I know exactly the query to do this.
Thank you
SunilLike this?
SQL> create table test(id number , dt date); Table created. SQL> insert into test values(&a,&b); Enter value for a: 1 --- It asked me and I entered 1 Enter value for b: sysdate --- It asked me and I entered sysdate old 1: insert into test values(&a,&b) new 1: insert into test values(1,sysdate) 1 row created. SQL>
g.
-
Compare the column values for multiple lines
I am new to oracle and I have a requirement to compare the values of column across multiple lines. If all column values are the same, I want to display that value, if the columns are not the same, I need to display 'no match' as value. I need id to group values and display a status value based on the above logic. Can anyone offer assistance with dispalying the result expected below?
Sample
Table
State ID
1 S
2 L
1 S
2 S
expected results
State ID
1 S
2 no match
Hello
That's what you asked for:
SELECT id
CASE
WHEN COUNT (DISTINCT status) > 1
THEN "no match."
For ANOTHER MIN (status)
The END as status
T
GROUP BY id
;
Want that if each State ID is NULL? The CASE expression above returns NULL in this situation.
-
SQL multiple columns in a single row
Hi all
I have 2 tables, product and Product_Name, a product can have several names.
I need to recover what I show the Product_ID followed by all the names of this product has.
I am not able to do, every way I try get the product ID duplicated several lines with a name of different product on each line as follows:
' 1, ' iron Z.
1, "iron M.
1, "iron N".
2, 'wood P.
2, 'wood M.
What I need is:
1, Z, M iron, iron N
2, wood P, wood M
Thank you and best regards.Hello
user10103934 wrote:
Thanks for the reply from Frank,Iron Z, iron and iron N M would be 3 different entries in the same column.
I'm sure that the LISTAGG function should solve this problem, the problem is that I expected to find a solution on pure SQL or PL/SQL, perhaps with a nested Select statement.
My version of Oracle's 10g Express Edition.
LISTAGG is pure SQL, but it was introduced only in Oracle 11.2. All mentioned below should work in Oracle 10.
The STRAGG from this page is very useful. You must copy and install approximately 60 line of PL/SQL code. Do it once, and then you can use hundreds of times in hundreds of motions, as if it were a built-in function. The main problem with STRAGG, it is difficult to get the output soprted. There is a modified version, designed for output sorted on this thread:
http://asktom.Oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:15637744429336
Never used. Can't vouch for it.SYS_CONNECT_BY_PATH seems to be the most popular way after the aggregation of the chain in Oracle 10. The example given on the page of the Oracle Base (that I posted in my last post) is a little clumsy and inefficient. See the next thread for a better example, using CONNECT_BY_ISLEAF:
Re: Concatenate strings more lines in a single line.
or, now that I see it, Pollywog example above.Published by: Frank Kulash, June 11, 2010 14:24
-
Adding field values into multiple lines in a dynamic table
Hello!
I have create this form (timesheet) where I have a dynamic array with a variable number of lines (I'm adding instances with a single click of a button).
All rows with a field of totalLinhaRelatorio , it is a time field and I need all of these fields to be added to get a total final.
So, I tried these two lines of script (FormCalc):
var finalTotal = sum (Time2Num (rio parteInferior.atividades.tabelaAtividades.linhaAtividade [*] [*] .totalLinhaRelato, "HH: mm"))
$.formattedValue = Num2Time (finalTotal, "HH: mm")
It doesn´t works as I expected. The field gets properly just the value of the first row.
I tried other combinations, such as linhaAtividade.totalLinhaRelatorio [*] and .totalLinhaRelatorio linhaAtividade [*], but nothing seems to work.
Help, please!
Marcos
You're welcome Marcos!
Yes, it is possible, but I've never used FormCalc to do, preferring to JavaScript. As you use the time functions, it makes sense to stick with FormCalc.
Take a look at the syntax here:
http://help.adobe.com/en_US/livecycle/9.0/designerHelp/index.htm?content=000211.html.
Hope that helps,
Niall
-
Combine multiple lines in a single line
Hello
I want the output of several data of line in a row.
I try to display the supervisor of people and their supervisors and so on. I am able to display the Level1 supervisor and not able to display the next level.
Here is the code:
order by length (s.path) desc nulls last
PERSON_ID Employee_name SUPERVISOR_1 SUPERVISOR_2 100299 VELASCO, OMAR UREÑA, PABLO USLENGHI, MATIAS slimani 58293 UREÑA, PABLO USLENGHI, MATIAS slimani Slimani, Mr. Vrishal A 98539 USLENGHI, MATIAS slimani Slimani, Mr. Vrishal A Harvey, Mr. Darin S 68240 Slimani, Mr. Vrishal A Harvey, Mr. Darin S CLARK, TIM MIDDLE EAST 72230 Harvey, Mr. Darin S CLARK, TIM MIDDLE EAST BOEHLER, JEFF HAS 76200 CLARK, TIM MIDDLE EAST BOEHLER, JEFF HAS FRADIN, ROGER 67819 BOEHLER, JEFF HAS FRADIN, ROGER - 29202 FRADIN, ROGER - - Concerning
Adrien
-
Create views of data from multiple lines in a single column shows
Hi all - it's probably posted in the wrong forum, but I couldn't find that was right.
I'm almost a perfect beginner in sql, but I have a need to create a view that can be expanded to 10g (which effectively runs the volumes are likely to be high) who will do the following.
Authentic table with columns Parent_code, Child_code
Parent_Code Child_Code
1000-2000
1000-3000
1000-4000
2000 3000
2000-5000
(note that Parents may have several children and a child can have multiple parents!)
What I have to finish with in my opinion is the following
Child_Code Parent_List
' 2000 ' 1000 (3).
3000 "1000 (3), 2000 (2)"
' 4000 ' 1000 (3).
"5000 ' 2000 (2)"
Note the number in parentheses is the number of children whose parent's - IE in the original parent a 1000, 3 table lines (one for each child)
This point of view should be used as a quick glance upward (on the children's code) for a report of business objects.
Is there someone who could you PLEASE, PLEASE help me quickly on what I have very little time to find a solution?Hello
You can test these:
select child_code , ltrim(sys_connect_by_path(parent_info,', '), ', ') as parent_list from ( select child_code , to_char(parent_code) || ' (' || count(*) over(partition by parent_code) || ')' as parent_info , row_number() over(partition by child_code order by parent_code) rn from your_table ) where connect_by_isleaf = 1 connect by prior rn = rn-1 and prior child_code = child_code start with rn = 1 ;
select child_code, rtrim( extract( xmlagg(xmlelement("e",parent_info||', ') order by parent_info) , '//text()' ) , ', ' ) as parent_list from ( select child_code, to_char(parent_code) || ' (' || count(*) over(partition by parent_code) || ')' as parent_info from your_table ) group by child_code ;
What you need is called 'chain aggregation '.
See here for the various techniques, including the two above: http://www.oracle-base.com/articles/misc/StringAggregationTechniques.php -
How elimate the grid lines in a single row of a table?
I have a table that has 5 lines. The table has a border of 1, so there are the grid lines. How can I eliminate the horizontal border between the 1st row of row 2?
There is never vertical grids. You want to keep them? Then, you need to use a slightly different approach.
Consider this CSS-
table {}
border-collapse: collapse;
border: 1px solid black;
}
TD {}
border: 1px solid black;
}
TR. Top td {}
border-bottom: none;
}
TR. Bottom td {}
border-top: none;
}
-
Multiple lines in a single pipe delimited lines...
Hi all
I have the following data in multiple columns that should be converted online unique pipedelimited.
Following is the example:
DEPTNO ENAME
===== =====
10A
10 B
10 C
Now my requirement is to output, I should be able poster A | B | C|.........
Note: The number of lines for any DEPTNO is not constant.
Thank you
Kalyan Kumar PThe link that allowed to Hoek
SELECT LTRIM(MAX(SYS_CONNECT_BY_PATH(ename,',')) KEEP (DENSE_RANK LAST ORDER BY curr),',') AS employees FROM (SELECT deptno, ename, ROW_NUMBER() OVER (PARTITION BY deptno ORDER BY ename) AS curr, ROW_NUMBER() OVER (PARTITION BY deptno ORDER BY ename) -1 AS prev FROM emp WHERE deptno=10) GROUP BY deptno CONNECT BY prev = PRIOR curr AND deptno = PRIOR deptno START WITH curr = 1
If please visit once and read it.
Kind regards
Bobin -
Multiple lines in a single column in an SQL statement
Can someone provide me with a simple sql that runs on the underside of the table (USERROLE table)
ID ROLEUSER ROLENAME
1 user1 GL
User2 OBI_AP 2
User1 3 OBI_AP
User2 4 GL
User1 5 OBI_AR
User2 6 AR
7 the GL util_3
and give the result form
ROLENAMES ROLEUSER
User1 GL; OBI_AP; OBI_AR
User2 OBI_AP; GL; AR
the GL util_3
Thank you
VikramHello
There is a similar thread, you can watch: concatenate the values of column in a row
Kind regards
-
Splitting of multiple lines on a single line with different fields
Hi all
I have a table. A Course_Code have section_codes several other words ('NUM' column is not sectype is just an order!)
Code---num---Sec_code---Sectype---DESC---WEIGHT
1603 1 - C 7427 - Coursework - 50
1603--------2-------7428-----------E------------ Exam---------------- 50
I query this table I want to be able to see the course work, review divided on the same line. i.e.
Code - Coursework - review
1603 C = 50 - E = 50
any help would be greatHello
'Splitting' means take an element (such s as a string 'C = 50') and diviiding in smal; LER objects (such as the chains under "C" and "50"). Are you really trying to divide something, or are you trying to do exactly the opposite (for example, combine smaller chains in a larger string)?
I think that what you are looking for is a Pivot . Like so many other things, exactly how do depends on your version of Oracle and your needs.
Here's one way:SELECT code , MIN (CASE WHEN descr = 'Coursework' THEN sectype END) || '=' MIN (CASE WHEN descr = 'Coursework' THEN weight END) AS coursework , MIN (CASE WHEN descr = 'Exam' THEN sectype END) || '=' MIN (CASE WHEN descr = 'Exam' THEN weight END) AS exam FROM table_x GROUP BY code ;
It will work in Oracle 8.1 and higher. From Oracle 11.1, you can also use the SELECT... Function PIVOT.
I hope that answers your question.
If not, post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all tables and also post the results desired from these data.
Explain, using specific examples, how you get these results from these data.
Always tell what version of Oracle you are using. -
----------------------------------------------------------------------------------------------------------------------------------------------------------_*Oracle Version:*_ Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product PL/SQL Release 10.2.0.1.0 - Production CORE 10.2.0.1.0 Production TNS for 32-bit Windows: Version 10.2.0.1.0 - Production NLSRTL Version 10.2.0.1.0 - Production _Table Structure :_ CREATE TABLE EMPTEST ( EMPNO NUMBER, TELEPHONE NUMBER, STREETNAME VARCHAR2(25 BYTE), CITY VARCHAR2(2 BYTE), FLAG VARCHAR2(1 BYTE), CONCAT1 CHAR(25 BYTE) ) CREATE TABLE EMPTEST1 ( EMPNO NUMBER, TELEPHONE NUMBER, STREETNAME VARCHAR2(25 BYTE), CITY VARCHAR2(2 BYTE), FLAG VARCHAR2(1 BYTE), CONCAT1 CHAR(25 BYTE) ) INSERT INTO EMPTEST VALUES (102,88777,'JAC ST ',' ','Y',' '); INSERT INTO EMPTEST VALUES (102,0,'ROMA MAIN',' ','Y',' '); INSERT INTO EMPTEST VALUES (101,213566,' ',' ','Y',' '); INSERT INTO EMPTEST VALUES (101,0,'BLE ST',' ','Y',' '); INSERT INTO EMPTEST VALUES (101,0,' ','MT','Y',' '); INSERT INTO EMPTEST1 VALUES (102,88777,'JAC ST ',' ','Y',' '); INSERT INTO EMPTEST1 VALUES (102,0,'ROMA MAIN',' ','Y',' '); INSERT INTO EMPTEST1 VALUES (101,213566,' ',' ','Y',' '); INSERT INTO EMPTEST1 VALUES (101,0,'BLE ST',' ','Y',' '); INSERT INTO EMPTEST1 VALUES (101,0,' ','MT','Y',' ');
I am using the following query, That is expected and correct as well *.
I my get the output likeselect EMPNO, ltrim(sys_connect_by_path(rtrim(CONCAT1,' '),';'),';') EMPTEST1 from ( select EMPNO, row_number()over(partition by EMPNO order by EMPNO) rn, count(*)over(partition by EMPNO) cnt, CONCAT1 from EMPTEST ) where level = cnt start with rn=1 connect by prior rn=rn-1 and prior EMPNO=EMPNO
I always get 2500 records in my ouptut, even if I have more than 30 000.{table} EMPNO EMPTEST1 101 213566 Y;0BLE ST Y;0 MTY 102 88777JAC ST Y;0ROMA MAIN Y {table}
If I sys_connect_by_path manage no more than 2500... Someone can give me a reason why it handles no more than 2500 and how do I handle if I get more than 30000 reocrds
Thank you
Ananda
Published by: Ananda on July 12, 2010 20:25Ananda says:
I always get 2500 records in my ouptut, even if I have more than 30 000.If I sys_connect_by_path manage no more than 2500... Someone can give me a reason why it handles no more than 2500 and how do I handle if I get more than 30000 reocrds
SYS_CONNECT_BY_PATH covers the CHAR/VARCHAR2 data type and returns a VARCHAR2. And VARCHAR2 limit is 4000 bytes. As soon as you exceed it it will be a mistake. Use rather XMLAGG. For example:
SQL> select xmlagg(xmlelement(e,ename,' ').extract('//text()')) ename 2 from emp 3 group by deptno 4 / ENAME ------------------------------------------------------------ CLARK KING MILLER SMITH FORD ADAMS SCOTT JONES ALLEN BLAKE MARTIN TURNER JAMES WARD SQL>
SY.
-
Multiple lines in a single count
Hello
I have a table (join actually) similar to the following:
Tree leaf... TLigne
1... 1... 1
1... 2... 2
2... 3... 1
3... 4... 2
3... 5... 3
3... 6... 3
3... 7... 3
What would be the best approach if I wanted to count the frequency of each type of leaf per tree?
The goal contains a line for each tree and three different columns representing
the number of occurrences of each journal type.
Example:
tree... LT1... LT2... LT3
1... 1... 1... 0
2... 1... 0... 0
3... 0... 1... 3
Thanks for any help.>
Select tree, sum (decode (TLigne, 1, 1, 0)), sum (decode (TLigne, 2, 1, 0)), sum (decode (TLigne, 3, 1, 0)))
Select 1 tree, 1 extension, 1 TLigne of all the double union
Select TLigne 1,2,2 Union double all the
Select TLigne 2,3,1 Union double all the
Select 3,4,2 TLigne from all the double union
Select TLigne 3,5,3 of all the double union
Select 3,6,3 TLigne from all the double union
Select 3,7,3 double TLigne
)
Group by tree
Kind regards
RiteshPublished by: Ritesh Kumar S on December 25, 2008 15:56
-
Hi all
I have a requirement as below.
Select * from my_tab;
col1 col2 col3
1 test1 January 1, 2014
Test2 2 2 January 2013
3 test5 February 9, 2015
I need to display it as below.
col1 col2 col3 req_col
-----------------------------------------------------
1 test1 January 1, 2014
2 test2 January 2, 2013 January 1, 2014
3 February 9, 2015 test5 January 2, 2013
So how do?
If it is not possible with sql then suggest me to do in peblisher xml (in rdf or rtf)
Hello
jagadekara wrote:
Hi all
I have a requirement as below.
Select * from my_tab;
col1 col2 col3
1 test1 January 1, 2014
Test2 2 2 January 2013
3 test5 February 9, 2015
I need to display it as below.
col1 col2 col3 req_col
-----------------------------------------------------
1 test1 January 1, 2014
2 test2 January 2, 2013 January 1, 2014
3 February 9, 2015 test5 January 2, 2013
So how do?
If it is not possible with sql then suggest me to do in peblisher xml (in rdf or rtf)
In SQL, you can use the analytic LAG function.
http://docs.Oracle.com/database/121/SQLRF/functions093.htm#sthref1544
Because I don't have a copy of your table, I'll use scott.dept to illustrate:
SELECT DeptNo
dname
loc
, Trolling (loc) over (ORDER BY deptno) AS prev_loc
OF scott.dept
ORDER BY deptno
;
Output:
DEPTNO DNAME LOC PREV_LOC
---------- -------------- ------------- -------------
10 ACCOUNTS NEW YORK
SEARCH 20 DALLAS NEW YORK
30 SALES CHICAGO DALLAS
40 OPERATIONS BOSTON CHICAGO
Maybe you are looking for
-
Driver help from ACPI\HPQ0007
I have a HP Pavilion Dv9000 laptop. In Device Manager, I have a problem with an unknown device with an ACPI\HPQ0007 pilot. Help, please!
-
How can I play a Quicktime (.mov) file in windows media player?
My computer (Vista) downloaded my videos from my camera to the .mov format. I have quicktime on my computer and can be read using this software. But I want to import videos in Windows Movie Maker and Movie Maker does not recognize the .mov file. H
-
hp laserjet 1536dnf mfp scanner installation of the product for Windows XP 64-bit
We have upgraded my computer to Windows XP 64-bit. I can install the printer drivers for it, but have been unable to install the scanner software. Can you direct me to the correct installation page to do this?
-
Programming an application for blackberry
Hello Can program us any application in common. So it supports all blackberry devices. If it so? Please tell me how?
-
order cisco call manager 5.0
When you place your order call manager 5.0, if you select the MCS7835I1-K9-CM50 HW/SW unified CallMgr 5.0 7835-I1 device, 0 seats You have also to order LIC - CM5.0 - 7835-I1 = License CallMgr 5.0 7835-I1 device If you order LIC-CM-DL-1000 = CallMana