Multiple rows/values
How do I extract values if one of the tabs can occur multiple times?
Here is my xml structure:
JobPositionPosting > dsSearch > dsId > "technis"
JobPositionPosting > dsSearch > dsLocation > dsLongitude > "-889558"
JobPositionPosting > dsSearch > dsLocation > dsLatitude > "404743"
JobPositionPosting > JobPosting > JobPositionPosting > JobPositionPostingId > "1001117543"
JobPositionPosting > JobPosting > JobSpecific > DigestedSkills > Skill > "automation"
JobPositionPosting > JobPosting > JobSpecific > DigestedSkills > Skill > "c"
JobPositionPosting > JobPosting > JobSpecific > DigestedSkills > Skill > "c#"
JobPositionPosting > JobPosting > JobSpecific > DigestedSkills > Skill > "c++"
JobPositionPosting > JobPosting > JobSpecific > DigestedSkills > Skill > "clearcase"
JobPositionPosting > JobPosting > JobSpecific > DigestedSkills > Skill > "design"
JobPositionPosting > JobPosting > JobSpecific > DigestedSkills > Skill > "development"
If I run the query below it runs just fine.
select
extractValue(object_value, '/JobPositionPosting/dsSearch/dsId') dsId ,
extractValue(object_value, '/JobPositionPosting/dsSearch/dsLocation/dsLongitude') LONGIT ,
extractValue(object_value, '/JobPositionPosting/dsSearch/dsLocation/dsLatitude') Lat
from DANB.invoicexml_tbl
But when I try to include skills it blows up with
select
extractValue(object_value, '/JobPositionPosting/dsSearch/dsId') dsId ,
extractValue(object_value, '/JobPositionPosting/dsSearch/dsLocation/dsLongitude') LONGIT ,
extractValue(object_value, '/JobPositionPosting/dsSearch/dsLocation/dsLatitude') Lat,
extractValue(object_value, '/JobPositionPosting/JobPosting/JobSpecific/DigestedSkills/Skill') skill
from DANB.invoicexml_tbl
ORA-19025: EXTRACTVALUE returns value of only one node
Looks like having skil there multiple times is a problem.
You need to use XMLTable (or table(xmlsequence(extract(...))) if your version doesn't have XMLTable) to parse out the repeating elements into multiple rows.
Here is a sample based off what you posted
WITH base AS
(SELECT XMLTYPE('<?xml version="1.0" encoding="UTF-8"?>
<JobPositionPosting>
<dsSearch>
<dsId>technis</dsId>
<dsLocation>
<dsLongitude>-889558</dsLongitude>
<dsLatitude>404743</dsLatitude>
</dsLocation>
</dsSearch>
<JobPosting>
<JobPositionPosting>
<JobPositionPostingId>1001117543</JobPositionPostingId>
</JobPositionPosting>
<JobSpecific>
<DigestedSkills>
<Skill>automation</Skill>
<Skill>c</Skill>
<Skill>c#</Skill>
<Skill>c++</Skill>
<Skill>clearcase</Skill>
<Skill>design</Skill>
<Skill>development</Skill>
</DigestedSkills>
</JobSpecific>
</JobPosting>
</JobPositionPosting>') xmlcol
FROM dual
SELECT m.dsid, x.*
FROM base,
xmltable('/JobPositionPosting'
PASSING base.xmlcol
COLUMNS
dsId VARCHAR2(20) PATH '/JobPositionPosting/dsSearch/dsId',
skills XMLTYPE PATH '/JobPositionPosting/JobPosting/JobSpecific/DigestedSkills/Skill') m,
xmltable('/Skill'
PASSING m.skills
COLUMNS
ind_skill VARCHAR2(20) PATH '/Skill') xproduces
DSID IND_SKILL
technis automation
technis c
technis c#
technis c++
technis clearcase
technis design
technis development
Similar Messages
-
Concatenate multiple row values into single column value
Hello,
Can anyone please refresh my memory on how to concatenate multiple row values into a single column value.
In the following query, I will get multiple denial reasons per application and I would rather return all denial reasons on one line.
SELECT a.application_id, a.membership_number,
r.reason_text AS denial_reason,
a.appl_receipt_date AS application_receipt_date,
a.plan_request_1 AS application_plan_code,
a.adjudication_date AS application_denial_date
FROM application a, PLAN p, application_reason ar, reason r
WHERE a.plan_request_1 = p.plan_cd
AND a.application_id = ar.application_id
AND ar.reason_id = r.reason_id
AND a.adjudication_cd = 'D'
AND a.appl_receipt_date BETWEEN '01-jan-2006' AND '31-dec-2006'
AND p.plan_type_id = 12 and a.application_id = :appId
ORDER BY application_id
Any help is greatly appreciated.
Thanks,
-Christinefound the following
SELECT deptno,
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)
GROUP BY deptno
CONNECT BY prev = PRIOR curr AND deptno = PRIOR deptno
START WITH curr = 1;
DEPTNO EMPLOYEES
10 CLARK,KING,MILLER
20 ADAMS,FORD,JONES,SCOTT,SMITH
30 ALLEN,BLAKE,JAMES,MARTIN,TURNER,WARD
3 rows selected.at http://www.oracle-base.com/articles/10g/StringAggregationTechniques.php -
JSF datatable to get multiple row values
I want to get values of SelectBooleanCheckbox and SelectOneMenu in jsf bean from datatable for multiple rows?
You can find an example here: http://balusc.blogspot.com/2006/06/using-datatables.html
-
Multiple row values of a column (variable) into a single record
Hi,
I have the follwing table structure - ITEM_MASTER
Item Item_Parent Item_Type
------- ---------------------- -----------1000 ITEM
998272 1000 EAN
998873 1000 EAN
998874 1000 EAN
I need it as follows:
Item EAN1 EAN2 EAN3
1000 998272 998873 998874
The query I am trying to use outer join as follows but without success:
select im.item, im_ean1.item,
from ITEM_MASTER im
LEFT OUTER JOIN on ITEM_MASTER im_ean1
on (im.item = im_ean1.item_parent and im_ean1 = 'EAN' )
I am not getting the 3 EANs in a single row.
I am getting them in multiple rows.
Please suggest how should I proceed.
Thanks in advance
Suddha Satta RayRANK may give you multiple time same occurrence, that's why I used ROW_NUMBER, see example below :
SQL> ed
Wrote file afiedt.buf
1 select sal,
2 rank() over (order by sal) rk,
3 dense_rank() over (order by sal) drf,
4 row_number() over (order by sal) rn
5* from emp
SQL> /
SAL RK DRF RN
800 1 1 1
950 2 2 2
1100 3 3 3
1250 4 4 4
1250 4 4 5
1300 6 5 6
1500 7 6 7
1600 8 7 8
2450 9 8 9
2850 10 9 10
2975 11 10 11
3000 12 11 12
3000 12 11 13
5000 14 12 14
14 rows selected.
Elapsed: 00:00:00.00
SQL> Maybe it's your problem.
Nicolas. -
Hi Friends,
I have a table layout as follows
Friends FirstName LastName
Friend1 Annie Bose
Friend2 Lisa Ray
Friend3 Mary D'sourza
GO
when i click on this GO button all three row values hould be stored in the table
but i m able to save only the first row value(Annie,Bose)
How to save other row values?(Lisa Ray and Mary D'sourza)
I am attaching the code
//Rows.html
<html>
<body>
<form method="post" action="Rows.jsp">
<table border=1>
<tr><td>Friends</td><td>First Name</td><td>Last Name</td></tr>
<tr><td>Friend1</td><td><input type="textbox" name="fname"></td><td><input type="textbox" name="lname"></td></tr>
<tr><td>Friend2</td><td><input type="textbox" name="fname"></td><td><input type="textbox" name="lname"></td></tr>
<tr><td>Friend3</td><td><input type="textbox" name="fname"></td><td><input type="textbox" name="lname"></td></tr>
</table>
<input type="submit" name="s1" value="Go">
</form>
</body>
</html>
//Rows.jsp
<html>
<body>
<%@page import ="java.sql.*" %>
<%
try
String fname=request.getParameter("fname");
String lname=request.getParameter("lname");
Class.forName("acs.jdbc.Driver");
String url = "jdbc:atinav:localhost:7227:C:/Try.mdb";
Connection con= DriverManager.getConnection(url);
PreparedStatement pstmt=con.prepareStatement("insert into Friends values(?,?)") ;
pstmt.setString(1,fname);
pstmt.setString(2,lname);
int cnt=pstmt.executeUpdate();
System.out.println("values inserted");
Statement stmt=con.createStatement();
ResultSet rst=stmt.executeQuery("select * from Friends");
while(rst.next())
String str1=rst.getString("FirstName");
String str2=rst.getString("LastName");
out.println(str1);
out.println(str2);
catch(Exception e)
e.printStackTrace();
%>
</body>
</html>
Please solve my problem asap
It's urgent
Thanx in advance
Poojaenumerate the field names on the form
<%int value=number of text fields
for (int i=0; i<value; i++)
{ %>
<input type="text" name="first_name<%=i%>"> <input type="text" name="last_name<%=i%>">
<%}%>
<input type="hidden" name="value" value="<%=value%>">
<input type="submit">then in your other jsp
int value=Integer.parseInt(request.getParameter("value"));
for (int i=0; i<value; i++)
request.getParameter("first_name"+i) + request.getParameter("last_name"+i);
//write to db -
10GR2 - How can I load multiple row values into one field?
Hi
Can anyone please help with a problem I'm having with merging data.
The source table has multiple entries for the same Id e,g,
ID Code
1 123
1 234
2 123
2 567
The output should only have one row per ID e.g.
ID Code_List
1 123;234
2 123;567
Do you know what operator I could use that would allow me to do this? I've looked at unpivot but I think I would need multiple output fields (one for each Code). I have to concatinate the codes and separate with a semi-colon.
Thanks
GBQ) Input data
=============
COL_0,COL_4
1235,"G0123,G124,G25,G6"
1236,"G01,G23,G124,G25,G6"
1237,"G0123,G1,G24,G25,G6"
1238,"G,G0123,G124,G25,G6"
1239,"G0123124,G256"
Output
======
TEST_ID,TEST_VAL
1235,G0123
1235,G124
1235,G25
1235,G6
1236,G01
1236,G23
1236,G124
1236,G25
1236,G6
1237,G0123
1237,G1
1237,G24
1237,G25
1237,G6
1238,G
1238,G0123
1238,G124
1238,G25
1238,G6
1239,G0123124
1239,G256
I wrote this procedure...
declare
rcd_cnt number;
test_id123 number;
junk_1 number;
cd_occurences number;
child_count number;
str_abc varchar2(200);
char_pos number default 0;
cd_temp_str varchar2(50);--:= 'G0123,G124,G25,G6';
begin
select nvl(count(col_4),0) into rcd_cnt from test_ee where col_4 is not null;
for aa in 1 .. rcd_cnt loop
select col_0,rownum rn,nvl(trim(col_4),0) into test_id123,junk_1,cd_temp_str from (select col_0,rownum rn,col_4 from test_ee where col_4 is not null) where rn = aa;
--dbms_output.put_line('...I am in for loop...' || cd_temp_str);
--dbms_output.put_line('===================' || rcd_cnt || '.................' ||aa);
cd_occurences := length(cd_temp_str) - length(replace(cd_temp_str,','));
dbms_output.put_line(cd_temp_str || '...Str Occurences are ...'||cd_occurences ||'**************'||test_id123);
child_count :=0;
for z in 1..length(cd_temp_str)+1 loop
child_count := child_count+1;
if(instr(cd_temp_str,',') > 0) then
char_pos := instr(cd_temp_str,',',1,1);
str_abc := substr(cd_temp_str,1,char_pos-1);
dbms_output.put_line('..Partial String of..'|| z ||'..is.....' || str_abc);
insert into test_xx(test_id,test_val) values(test_id123,str_abc);
end if;
cd_temp_str := substr(cd_temp_str,char_pos+1,length(cd_temp_str));
if(cd_occurences=child_count) then
dbms_output.put_line('..Partial String of..is.....' || cd_temp_str);
insert into test_xx(test_id,test_val) values(test_id123,cd_temp_str);
end if;
end loop; -- close for of z */
--dbms_output.put_line('...I am in end for loop...');
end loop; -- close for of aa
end;
instead of procedure,is there any way from sqlqery. -
Multiple row value coming in a single row(nclob)
hi ,
i have a requirement where i have to work on a column on datatype nclob, now here the value of 2 rows coming into a single column. like this:
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'
--and bchistevent.bucket = to_char (add_months (sysdate, -1),'YYYYMM')
395452969-000-20130103 1.46388193452398E37 1/8/2013 3:05:42 AM
300000590-000-20090723 1.46388193452398E37 1/11/2013 8:11:45 AM
300000590-000-20090723 1.46388193452398E37 1/11/2013 8:12:50 AM
395453127-000-20130103 1.46388193452398E37 1/14/2013 4:44:26 AM
*300084670-000-20120906, 300084671-000-20120906* 1.46388193452398E37 1/7/2013 12:45:19 AM
395452626-000-20130103 1.46388193452398E37 1/8/2013 3:03:57 AM
300084679-000-20120906 1.46388193452398E37 1/11/2013 8:10:47 AM
300000728-000-20090731 1.46388193452398E37 1/11/2013 8:19:19 AM
300084679-000-20120906 1.46388193452398E37 1/14/2013 12:31:48 AM
300000590-000-20090723 1.46388193452398E37 1/14/2013 4:13:19 AM
395452718-000-20130103 1.46388193452398E37 1/8/2013 7:10:19 AM
300084679-000-20120906 1.46388193452398E37 1/23/2013 6:54:11 AM
300084679-000-20120906 1.46388193452398E37 1/22/2013 3:11:54 AM
300000590-000-20090723 1.46388193452398E37 1/11/2013 8:14:02 AM
395453127-000-20130103 1.46388193452398E37 1/14/2013 4:33:12 AM
300084679-000-20120906 1.46388193452398E37 1/22/2013 3:03:36 AM
300084679-000-20120906 1.46388193452398E37 1/14/2013 12:34:13 AM
395452997-000-20130103 1.46388193452398E37 1/7/2013 3:31:38 AM
395452391-000-20121027 1.46388193452398E37 1/3/2013 4:40:05 AM
and the value of bold highlighted row is coming in a single row, plzz help how to break this in 2 rows??
Edited by: user1175303 on Mar 13, 2013 5:43 AMuser1175303 wrote:
the column value which is in question is <Anything><invoiceNumber>300084670-000-20120906, 300084671-000-20120906</invoiceNumber></Anything> here i am getting 2 values in a single column and because of this i am unable to get desired output...So you have XML issue but trying to resolve it in Oracle??? Why <invoiceNumber> holds two invoice numbers? Anyway:
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
/SY. -
Getting multiple row value on valuechange of selectBooleanCheckbox in table
Hello All,
I am using jDeveloper 11.1.1.5. I have a java class which is returning me a list. I have created a data control of my class and I am using it on my page as a table.
On my page I have inserted a text box selectedamount. In my table there are 4 columns Type, Qty, Amount and one boolean value select. I have changed column select to selectBooleanCheckbox. and I have specified its value as true(when selected) and false(when deselected). Which is getting reflected in my pagedef file.
There are 4 rows coming in table and displaying properly.
Now my requirement is on value change of selectBooleanCheckbox if user selects the rows I want to add the Amount for the selected row and I have to set it to the text box selectedamount.
On value change of selectBooleanCheckbox I have written a method. Code snippet is like this:
+public void valueChanged(ValueChangeEvent valuechangeevent) {+
+if (valuechangeevent.getNewValue() == valuechangeevent.getOldValue()) {+
System.out.println("new value is same as old value");
+} else {+
System.out.println("************************new value is other than old value**********************************");
DCBindingContainer bindings =(DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding iter = bindings.findIteratorBinding("NAME OF MY ITERATOR");
float temp2 = 0;
Row currentRow ;
int count = (int)iter.getViewObject().getEstimatedRowCount();
for (int i=1; i<=count;i++) {
currentRow = iter.getRowAtRangeIndex(i);
+if(currentRow != null) {+
if(true == currentRow.getAttribute("select"))
+{+
temp2= temp2 + Float.parseFloat(currentRow.getAttribute("totAmount").toString());
System.out.println("value of total amount after adding is :: "+ temp2);
+}+
+}+
+}+
After this I am setting temp2 to selectedamount textbox.
But I am not getting the desired value in the textbox.
Is there any other method I can achieve this.
Thanks
Navin KInside f(currentRow != null) When I added
System.out.println(currentRow.getAttribute("select"));
It is showing as null.
So select attribute is not getting assigned as true or false while checking and unchecking selectboolean checkbox.
Am I missing something ? -
How to get multiple row values in one text box while clicking one row from grid?
hi friends,
i am working on flex4 web application i am using one datagrid ,it have two records(bills),one button and one text box.
ex:
customername salesrepname receipt no amount
venkat raj 1102 10000
ramu ramesh 1102 20000
here both receipt no is same.now i want to select one of this receipt and click pay button which is place in outside the grid.
now my need is after click the pay button in text box i need 10000+20000=30000,after click that button i want both receipts should be invisible...'
how i will do this,
any suggession,
Thanks
B.venkatesanOne way with 10g:
select mgr,
rtrim(xmlagg(xmlelement(empno,empno||',').extract('//text()')),',') emps
from emp
where mgr is not null
group by mgr;10g:
-- define this function:
create or replace
function concatenate(c Sys_refcursor, sep varchar2 default null) return varchar2
as
val varchar2(100);
return_value varchar2(4000);
begin
-- open c;
loop
fetch c into val;
exit when c%notfound;
if return_value is null then
return_value:=val;
else
return_value:=return_value||sep||val;
end if;
end loop;
return return_value;
end;
select mgr,
concatenate(cursor(select empno from emp e where e.mgr=emp.mgr order by empno),',')
from emp
where mgr is not null
group by mgr;With 11g:
select mgr,
listagg(empno,',') within group (order by empno) emps
from emp
where mgr is not null
group by mgr; -
Multiple row selection in Table
Hi Experts,
I have created one popup with a table inside that.
My question is how can i add multiple rows, enter value in those rows and on clicking the
copy button all the value in the rows will be copied into the main view.
All the rows should be editable.Hi Armin,
Thanks a lot for the reply.
In my application when i am selecting the multiple rows which i entered earlier in the popup window, it's getting populated into main window.
But in main window only one input field is there,so only the fiest record is getting displyed after selection.
Rest of the records i am not able to display in the main window.And the problem is i can't add more than one input field in main window. Rest of the values will be passed into R3 through coding but it can't be displayed on screen.
So please advice me on these two scenarios.
1 . How to populate multiple row values(input fields in popup window with value enterd by user) into
main view. In main view only one input field is there.
2 . How to pass all the selected values from main window to R3 by webdynpro coding.
All the values coming from popup need to be passed even though only one value is displayed.
Here the input field in main window is mapped to one model attrribute.
Thanks a lot. -
How To Concatenate Column Values from Multiple Rows into a Single Column?
How do I create a SQL query that will concatenate column values from multiple rows into a single column?
Last First Code
Lesand Danny 1
Lesand Danny 2
Lesand Danny 3
Benedi Eric 7
Benedi Eric 14
Result should look like:
Last First Codes
Lesand Danny 1,2,3
Benedi Eric 7,14
Thanks,
David JohnsonStarting with Oracle 9i
select last, first, substr(max(sys_connect_by_path(code,',')),2) codes
from
(select last, first, code, row_number() over(partition by last, first order by code) rn
from a)
connect by last = prior last and first = prior first and prior rn = rn -1
start with rn = 1
group by last, first
LAST FIRST CODES
Lesand Danny 1,2,3
Benedi Eric 7,14Regards
Dmytro -
How to select multiple rows from List Of Values
Hello,
I use ADF 11g to create my list of values (LOV). I want to select multiple rows from it. but i can't.
so how i can select many rows to set them in my adf table.
Thank in advanceHi,
LOV is map to an attribute in the viewObject so it will return only one value or more values from selected row. You can't select multiple rows from LOV.
But you can do this by using popup which you can select multiple rows and insert the selected rows to another table.
This blog post explain how to achieve this :
http://husaindalal.blogspot.com/2009/11/search-from-popup-and-add-to-new-table.html#comments
Sameh Nassar -
Hide multiple rows in a dynamic table based on the row value.
Hi,
I need to hide multiple rows in a dynamic table based on the specific value of that row.
I cant find the right expression to do that.
please helpGo to the Row Properties, and in the Visibility tab, you have "Show or hide based on an expression". You can use this to write an expression that resolves to true if the row should be hidden, false otherwise.
Additionally, in the Matrix properties you should take a look at the filters section, perhaps you can achieve what you wish to achieve through there by removing the unnecessary rows instead of just hiding them.
It's only so much I can help you with the limited information. If you require further help, please provide us with more information such as what data are you displaying, what's the criteria to hiding rows, etc...
Regards
Andrew Borg Cardona -
Display values of a single field in a multiple rows in a table region
Hi Tech-Gurus,
I want to display values of a single field ( which is in a table region) in multiple rows and also need to restrict the values from decimal number. If i click save, then it will throw exception "Decimal not allowed".
xxxxxx
yyyyyy
Reg.No
1234
5678
7654
I need to display the values of REG.NO in different rows like,
1234
5678
7654
and also need to validate as well against Decimal values.
Please help me with the code how i will iterate ?Hi,
I am assuming you are talking about displaying substrings from the Reg No in different rows. For this you would need to write a query which identifies the substrings and creates a separate row for each (ensure you choose values for all other columns in the table row). Kindly let me know if the understanding is incorrect.
To validate against decimal value you can use the java code by checking the difference of the number and the number on which modulus has been applied. Hope that helps.
Regards
Sumit -
Populating Combo Box list value In Multiple Row
Hi,
i to have the same problem .
I have used add_list_element to populate the list value of the combo box in multiple row.
I am selecting the list value from the database where the combo box value will be different for each row. However, when i do this.
All the previous row combo box list value will follow the combo box value in the last row. How can i resolve this?
i tried with lov but hasnt had any sucesss.in case of LOV can we make the list to appear automatuically and select a value????i havent had much sucesss over it??
is thr any work around for this apart from lov?Hi,
which product or technology are you talking about ?
Frank
Maybe you are looking for
-
Convert Website to PDF on Vista 64-bit
Hi, using Acrobat Pro 8.1.2 on Vista 64-bit both German versions. In Internet Explorer I see the Acrobat toolbar with all menu items. But regardless what I choose (Convert to PDF, Settings etc.) nothing happens! All other Microsoft Office Plugins wor
-
Interactive Reporting is not opening in Hyperion workspace
Hi, I have installed Hyperion Foundation Services 11.1.1.1.0 and IR 11.1.1.1.0 I am trying to access IR through Workspace I could see the procedure like File-> New-> Document_> interactive reporting document. Then i have selected a .oce file to make
-
....
-
No Transactions are executing in System
Dear All, SAP system giving dumps while executing any transactions. The dump is like SNAP_NO_NEW_ENTRY The Transaction log space is fully utilized as indicated in DB02 (Recovery:FULL) It is not allowing us to Back up the transaction log or even enter
-
Hi, I am extracting data from the following tables: BSEG,BKPF,COEP,MBEW and EINA. I have been told to create a VIEW etc. for this inorder to take the fields in BI. Can i use the data sources in RSA5 to take all the required data in BI? or do I have t