Query in selecting row wise information
Hello All,
Could you please help me in getting the row wise information for the Financial Reporting Studion Report? I have a report where the row information will be Revenue and Expenses. but the revenue and expenses should only carry for specific cost centers. For example XXXXRevenue should carry revenue for GL Account XXXX.
Iam not able to do this. Please help me.
Thanks.
Hi Geoff,
You can use the ROW_NUMBER and CASE Functions to acheive this. Here with , i have give u a small idea with an ex:
Qry :
B.ItemCode,SUM(B.PO1)[PO1],SUM(B.POQty1)[POQty1],SUM(B.PO2)[PO2],SUM(B.POQty2)[POQty2] From
select Itemcode
CASE when Sno=1 Then DocNum End [PO1]
CASE When Sno=1 Then Qty End [POQty1]
CASE when Sno=2 Then DocNum End [PO2]
CASE When Sno=2 Then Qty End [POQty2]
From(
Row_Number() Over (Order By Opor.Docnum) [Sno], Opor.DocNum,POr1.ItemCode,sum(POr1.Quantity)[Qty] from OPOR join Por1 on Opor.DocEntry=por1.DocEntry
ItemCode='20002' group by oPor.DocNum,por1.ItemCode
A where A.Sno<=2)B Group By B.ItemCode
Result :-
ItemCode PO1 POQty1 PO2 POQty2
20002 18 1.000000 19 10.000000
Thanks,
Karthikeyan.P
Similar Messages
-
Query that selects rows depending on information in other rows?
Hello!
I have this table that contains employment information about persons. Each person can have one or several rows in this table. The problem I have is that some people who have several jobs are a little special in the way that I need to query them. A person that has several jobs can look like this:
PKEY | PERSONID | EMPTYPE | IDNO | STARTDATE | ENDDATE
1 | 730813 | 0 | 1000 | 09-01-01 | 10-01-01
2 | 730813 | 1 | 1000 | 09-05-01 | 09-09-01
3 | 730813 | 0 | 1001 | 05-03-02 | 11-07-02
The person above has 2 active employments, the first one isn't really active since the person has another temporary employment that has replaced it, it's number 2 and it has the same IDNO. The difference is the EMPTYPE, the ordinary employment has number 0 and the temporary employment has the number 1. On row 3 is the persons other active employment with IDNO 1001 and EMPTYPE 0.
This is what I need to do:
I need to do a select that only gives me the rows 2 and 3 when the employment no 2 is seen as active by looking at the dates, when the current date is between the start and end dates. The select needs to give me rows 1 and 3 when the employment no 2 is no longer active, i.e. when the end date has passed.
Trying to sum it up, when there are several rows with the same PERSONID and the same IDNO and the current date is greater or equal to the STARTDATE but less or equal to the ENDDATE give me only the row where the EMPTYPE is 1 and not the one where the EMPTYPE is 0.
Is this possible to do?
Thanks.Hi,
Sorry, I can't follow what you're saying about dates. It's hard, not knowing what the date format is.
You probably want analytic functions to do this.
For example to chose the row with the higher emptype (when there is a choice):
WITH got_rnum AS
SELECT pkey, personid, emptype, idno, startdate, enddate
, ROW_NUMBER () OVER (PARTITION BY personid, idno
ORDER BY emptype DESC
) AS rnum
FROM table_x
SELECT pkey, personid, emptype, idno, startdate, enddate
FROM got_rnum
WHERE rnum = 1
;Whatever your criteria are for deciding which row you want to pick, make an ORDER BY clause in the ROW_NUMBR function that puts that row first.
If you want to include ties for the row chosen, use RANK instead of ROW_NUMBER.
Edited by: Frank Kulash on Aug 15, 2009 11:09 PM -
How to query the selected row?
i have a table displayed in a gridcontrol... how would i go about binding a controlButton to this table so that when this button is clicked, it returns the value of a particular column that is currently selected in the gridcontrol??? ... currently, when the button is clicked... it returns the top of the ResultSet which is always the same value... i would like it to return the value of the row that is currenlty selected in the table??? ... using infoProducers(sessionInfo and resultSetInfo)... thanx, james
After using bellow script it works fine
xfa.resolveNode("Formname.Table1.Row1["this.parent.index"].fieldname").rawValue; -
WAD - input locking for selected rows in planning querie!?
hello guys,
i need some ideas - in which way i can lock data entry functionality in IP query for selected rows? some rows in the query have an indicator S (sum) and some I (input). so i have a chance for selection, which rows are input rows and which rows are sum (dsiplay) rows.
but all rows are input ready in sap standard querydefiniton and i need some ideas how i could implement an row specific inputfunctionality.
example
ITEM KEYFIGURE
line 1 Input input ready
line 2 Input input ready
line 3 Sline display only/ no input
line 4 Input input ready
dataslices are no option, because i need to change the "Sline-rows" data via planning functions.
i need ideas for web, not excel.
thx for your ideas!
Edited by: David Jahn on May 4, 2010 2:03 PMHi David,
of course, it is possible to use two structures in BI-IP, e.g. one containing the key figures (may be restricted) and another one used in the rows where one uses only characteristic values. But then the number of lines in the row structure is static. It is possible to drill-down other characteristics as ususal.
One idea is to use you characteristic containing the 'S value' as a navigation attribute and to create a row structure containing two lines, one with the restriction # and one with S and the corresponding setting for input readyness (maybe a cell definition for input readyness is needed here). Then drill-down by the base characteristic of the navigation attribute. What is not so nice then that one will get a group change: drill-down characteristic by the row structure; but the system generated characteristic relationship for navigation attributes makes the non existing combinations not input ready.
Regards,
Gregor -
Row-Wise Session Variable Initialization Block (Max Rows)
Hi, we have a problem with Row-Wise Session Variable.
We'll try to implemented the security with a External Query and a Row-Wise Initialization Block. But when we'll try to open the Web Obiee and the rows of result of the query is more than 3000 rows, the browser is broken. The access is very slowly.
When the result of Query to Row-Wise Variable is more than 3000 rows and we'll try to open the Web Obiee, we have to close NQServer.EXE process of Obiee Server.
Is there a best practise or a limit rows in the Row-Wise Initialization Block?.
Thanks.You're Right, the people can't be in 3000 groups.
Is possible I don't explain my problem correctly.
We use this Row-Wise Variable for implement Data Level Security. .
For Example :
I have a fact table with Offices and Office's Sales.
And each Obiee User can see many Offices according to their level of security.
I want filter the fact table using a external SQL table implemented in a Session Row-Wise Variable and a User can have X Offices (In the worst case, 3000 Offices). -
How to Query the Summary Name from Custom Section Row Header Information
I need a query that can help me retrieve the summary name from a custom section row header information. We have a couple of Denorm tables that when the data is denormalized, the row_name field is only showing the denormalized alias name. We would like to be able to pull the summary name from the row header information section? How can we use the denorm alias name and join it to another table to find the associated summary name?
The following query returns the row name as well as the denorm row name, for a given custom section, where we specify the custom section by the denorm table. You oculd do this in other ways, it just depends on how you want to retrieve the information. Is this what you are looking for?
SELECT ml.Name [rowName], ml.langID, dr.NAME [denormRowName], dr.FKROWTEMPLATE, dt.GENERATED_TABLE_NAME
FROM DENORM_CS_ROW dr
inner join DENORM_CS_TABLE dt on dr.FK_DENORM_TABLE_ID = dt.ID
inner join commonextendedattributeml ml on dr.FKROWTEMPLATE = ml.fkOwner
where dt.NAME = 'myDenormTableName' -
Write the sql query to find largest value in row wise without using great
write the sql query to find largest value in row wise without using
greatest fuction?Another not so good way, considering you want greatest of 4 fields from a single record:
SQL> ed
Wrote file afiedt.buf
1 with t as (Select 100 col1,200 col2,300 col3,400 col4 from dual
2 union select 500,600,700,800 from dual
3 union select 900,1000,1100,1200 from dual
4 union select 1300,1400,1500,1600 from dual
5 union select 1700,1800,1900,2000 from dual
6 union select 2100,2200,2300,2400 from dual
7 union select 2800,2700,2600,2500 from dual
8 union select 2900,3000,3100,3200 from dual)
9 SELECT (CASE WHEN col1 > col2 THEN col1 ELSE col2 END) Max_value
10 FROM
11 (SELECT (CASE WHEN col1_col2 > col2_col3 THEN col1_col2 ELSE col2_col3 END) col1,
12 (CASE WHEN col2_col3 > col3_col4 THEN col2_col3 ELSE col3_col4 END) col2,
13 (CASE WHEN col3_col4 > col4_col1 THEN col3_col4 ELSE col4_col1 END) col3
14 FROM
15 (SELECT (CASE WHEN col1 > col2 THEN col1 ELSE col2 END) col1_col2,
16 (CASE WHEN col2 > col3 THEN col2 ELSE col3 END) col2_col3,
17 (CASE WHEN col3 > col4 THEN col3 ELSE col4 END) col3_col4,
18 (CASE WHEN col4 > col1 THEN col4 ELSE col1 END) col4_col1
19* FROM t))
SQL> /
MAX_VALUE
400
800
1200
1600
2000
2400
2800
3200
8 rows selected.
SQL> Edited by: AP on Sep 21, 2010 6:29 AM -
How to get all rows that are returned in inner sub query of select statemen
If a sub query in select statement returns more than one row than how to get all those returned rows in the final
output of the query .It will be all right if all column's value repeat and that multiple output of inner query comes
in another column .
How to get that ?As Frank said, you likely want a join, and likely an outer join to replicate the select in the projection. Something like:
SELECT id,stat, section, USER_ID concerned_person
FROM table_all,
left join table2
on room_id = sectoion and
sur_role = 'r001'
WHERE section IN (SELECT code
FROM t_area
WHERE dept= 'p002')An alternative, depending on where and how you are using the statement would be something like:
SQL> WITH t AS (
2 select 1 id from dual union all
3 select 2 id from dual),
4 t1 as (
5 select 1 id, 'One' descr from dual union all
6 select 1, 'Un' from dual union all
7 select 1, 'Une' from dual)
8 SELECT t.id, CURSOR(SELECT t1.id, t1.descr from t1
9 WHERE t1.id = t.id)
10 FROM t;
ID CURSOR(SELECTT1.ID,T
1 CURSOR STATEMENT : 2
CURSOR STATEMENT : 2
ID DESCR
1 One
1 Un
1 Une
2 CURSOR STATEMENT : 2
CURSOR STATEMENT : 2
no rows selectedJohn -
Query to delete rows months wise.
How can i delete some old months rows having thousands of rows for each month.
delete from t_name where create_date='01-AUG-05' -----Not giving any rows????
Please help to delete rows faster by selecting rows months wise ..
-YasserANDY on 06-MAR-09 at oracle >select * from emp;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 17-DEC-80 800 20
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7566 JONES MANAGER 7839 02-APR-81 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7788 SCOTT ANALYST 7566 19-APR-87 3000 20
7839 KING PRESIDENT 17-NOV-81 5000 10
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7876 ADAMS CLERK 7788 23-MAY-87 1100 20
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7900 JAMES CLERK 7698 03-DEC-81 950 30
7902 FORD ANALYST 7566 03-DEC-81 3000 20
7934 MILLER CLERK 7782 23-JAN-82 1300 10
7369 SMITH CLERK 7902 17-DEC-80 800 20
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7566 JONES MANAGER 7839 02-APR-81 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7788 SCOTT ANALYST 7566 09-DEC-82 3000 20
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7839 KING PRESIDENT 17-NOV-81 5000 10
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7876 ADAMS CLERK 7788 12-JAN-83 1100 20
7900 JAMES CLERK 7698 03-DEC-81 950 30
7902 FORD ANALYST 7566 03-DEC-81 3000 20
7934 MILLER CLERK 7782 23-JAN-82 1300 10
28 rows selected.
ANDY on 06-MAR-09 at oracle >
ANDY on 06-MAR-09 at oracle >
ANDY on 06-MAR-09 at oracle >select HIREDATE from emp where rownum <10;
HIREDATE
17-DEC-80
20-FEB-81
22-FEB-81
02-APR-81
28-SEP-81
01-MAY-81
09-JUN-81
19-APR-87
17-NOV-81
9 rows selected.
ANDY on 06-MAR-09 at oracle >select * from emp where hiredate between '01-JAN-80' and '01-JAN-82';
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 17-DEC-80 800 20
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7566 JONES MANAGER 7839 02-APR-81 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7839 KING PRESIDENT 17-NOV-81 5000 10
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7900 JAMES CLERK 7698 03-DEC-81 950 30
7902 FORD ANALYST 7566 03-DEC-81 3000 20
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 17-DEC-80 800 20
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7566 JONES MANAGER 7839 02-APR-81 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7839 KING PRESIDENT 17-NOV-81 5000 10
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7900 JAMES CLERK 7698 03-DEC-81 950 30
7902 FORD ANALYST 7566 03-DEC-81 3000 20
22 rows selected.
ANDY on 06-MAR-09 at oracle >delete from emp where hiredate between '01-JAN-80' and '01-JAN-82';
22 rows deleted.
ANDY on 06-MAR-09 at oracle >
ANDY on 06-MAR-09 at oracle >select * from emp where hiredate between '01-JAN-80' and '01-JAN-82';
no rows selected
ANDY on 06-MAR-09 at oracle >Why do you want to use =to_date('JAN-07','MON-YY');.You said you ant to delete AUG month data.
ANDY on 06-MAR-09 at oracle >delete from emp where hiredate=to_date('17-DEC-80');
2 rows deleted.
ANDY on 06-MAR-09 at oracle >rollback;
ANDY on 06-MAR-09 at oracle >delete from emp where hiredate=to_date('DEC-80','MON-YY');
0 rows deleted.
ANDY on 06-MAR-09 at oracle >HTH
Anand
Edited by: Anand... on Mar 6, 2009 1:14 PM -
Multiselect query to display selected row
HI All,
I have a requirements to do multiselect from a table region, and need to display the selected row values in the page.
so i am able to multiselect from the table but while trying to print the values it is always printing only one selected row values not multiple one.
the below code i am using to print multiple row selected values.
for (int i = 0; i < fetchedRowCount; i++) {
ABCEOViewRowImpl rowi =
(ABEOViewRowImpl)selectIter.getRowAtRangeIndex(i);
if (rowi != null) {
if ("Y".equals(rowi.getReprint())) {
for (int j = 0; j < fetchedRowCount; j++) {
String srnum = rowi.getSerialNumber();
throw new OAException("After getting Srno " +
srnum,
OAException.INFORMATION);
where fetchedrowcount --------no of rows in the table region
here srnum is printing only one value.
Please guide me where to check for this issue.
Thanks
DebThanks Sanujeet for reply,
yes, the second for loop is not required, just for to check i have added that one,
As you suggested now, i just kept one for loop and trying to print all the value through comma separated and added the Exception in the last.
for (int i = 0; i < fetchedRowCount; i++) {
ABCEOViewRowImpl rowi =
(ABCEOViewRowImpl)selectIter.getRowAtRangeIndex(i);
if (rowi != null) {
if ("Y".equals(rowi.getReprint())) {
srnum =srnum+rowi.getSerialNumber()+",";
if (srnum!="")
throw new OAException("After getting Srno " +
srnum,
OAException.INFORMATION);
Thanks
Deb -
Select Query to fetch rows that contain non alphabetic characters
how to select rows from a table (tab1) where a specific column (tab1.col1) has non alphabetic characters
hi,
you didnt specify which version you are using.
if you are working on oracle 10g you can use regular expressions like this:
select * from tab1 where regexp_like(col1,'[^[[:alpha:]]]'); -
Using row-wise multi-value GROUP system session variable in report filter
The title says it all except I am using 10g OBIEE.
What I want to do is filter on the dynamic system session variable GROUP created in a row-wise initialization block.
The GROUP vriable is being set up correctly and it shows the user dynamically put into the correct groups in Answers.
(Using the admin tool and looking at the user session, only the initial authentication block variables show up.)
But if I want to filter using the value of GROUP it doesn't work.
The obvious way is to choose the filter icon, then choose Add -> Variable -> Session, enter GROUP, and then display results.
It comes back with no rows.
Any idea how to do this? I've tried lots of things but none of them work either producing no rows or an error.
This is the kind of Answers SQL this report is resulting in, which makes sense to me, but produces no rows.
SELECT "Package Virtual Group (Dim)"."Package Virtual Group" saw_0, "Contact (Fact)"."Contacts All Count" saw_1 FROM "Case/Transaction/ABC" WHERE "Package Virtual Group (Dim)"."Package Virtual Group" = VALUEOF(NQ_SESSION."GROUP") ORDER BY saw_0866038 wrote:
Errors come from trying things that don't work.
For example, instead of =, using IN VALUEOF(NQ_SESSION.GROUP) or @{session.GROUP} or lots of other things.
The question is this:
how can I filter a column in Answers using the GROUP session variable which had been initialized in a row-wise initialization block?
I can find no way to do it. Mostly it returns no rows.Hi,
we had a similar requirement, where we have an external name that has project number values. We used row wise initialization to capture all the projects that a user belongs to. Then, we applied the filters at the RPD level, instead of doing it at the report level. From you requirement I see that you are trying to filter the groups based on user login. When a user logs in, he will see the information about the groups that he only belongs to. Correct me if I am wrong here.
Assuming I am right about your requirement, providing the filter that you need apply in RPD.
On all the fact tables are joined to the Package Virtual Group dimension, apply the below filter.
case when 1=1 then (Dim)"."Package Virtual Group" END = VALUEOF(NQ_SESSION."GROUP");
The reason for use of case statement here is, it converts the logical sql to IN Clause, helping us acheive the exact query that we would want.
Please Award points if this helps.
Thanks,
-Amith. -
OBIEE - Using Multiple Select Rows In Grid As Parameters
Hello All,
First post from an OBI Newbie. I am getting used to creating dashboards and have got my head around drilling with values, but I have a user requirement that I am not sure is possible.
A standard query returns the following datagrid information ("," = column divider):
Product Id, Product Description, Colour, Total Sales
1, Chair, Red, 4
2, Chair, Blue, 3
3, Chair, Black, 5
I know that I can enable a drill on a specific colour to give a datagrid such as (if Red Selected):
Order Reference, Product Id, Product Description, Colour, Units
687678657, 1, Chair, Red, 3
687678658, 1, Chair, Red, 1
The user requirement is to select multiple rows (possible by holding Ctrl) and to then effectively "drill" with the multiple selected values. Eg Red, Blue:
Order Reference, Product Id, Product Description, Colour, Units
687678657, 1, Chair, Red, 3
687678658, 1, Chair, Red, 1
687678660, 2, Chair, Blue, 3
I presume that a separate report will be required, but I am not sure how to trigger and/or pass the multiple product id's. Can anyone help with a solution?
Edited by: 885689 on 16-Sep-2011 06:27I got this working by changing the signature of the Application Module method to use ArrayList rather than String[], then you can marshal the Struts FormBean contents into an ArrayList to pass up.
To do this, subclass the DataAction by using "Go To Code" off of the context menu and then override the initializeMethodParameters() method:
protected void initializeMethodParameters(DataActionContext actionContext, JUCtrlActionBinding actionBinding)
//Get the String Array from the Form Bean
String[] selection = (String[])((DynaActionForm)actionContext.getActionForm()).get("multiSelect");
//convert that to an ArrayList
ArrayList selectionArr = new ArrayList( Arrays.asList(selection));
//Add that object to the Arg List for the AM method
ArrayList params = new ArrayList();
params.add(selectionArr);
actionBinding.setParams(params);
} -
Use Session Variable with row-wise initialization
Hello,
I use an initialization block in order to load some translations in my repository (version is 11.1.1.6.BP1) :
SQL :
SELECT CODE_KEY, STRING_VALUE FROM "TABLES" WHERE LANGUAGE_KEY= 'VALUEOF(NQ_SESSION.USERLOCALE)'
Values :
CN_INCOMING, Incoming, en
CN_OUTGOING, Outgoing, en
CN_INCOMING, Réception, fr
CN_OUTGOING, Emission, fr
etc ...
I checked the row-wise intialization.
The query is correct and returns the right values (I check in the log file ..).
So far, So good.
But when I want to use session variables in a column expression (in repository) like :
CASE WHEN "column"="xx" THEN VALUEOF(NQ_SESSION."CN_INCOMING") ELSE VALUEOF(NQ_SESSION."CN_OUTGOING") END
I got the error: [nQSError: 23006] The session variable, NQ_SESSION.CN_OUTGOING, has no value definition.
If I used the same formula directly in Answers it's working correctly.
Do I have to necessarily do this in answers or is there a way to do this in the repository.
Thanks in advance
Regards
BenjaminYes I already tested this point, when I don't use a row wise initialization it's working, but I don't want to create one variable for each translations that I need to use in column formula if you know what I mean.
I don't understand why we can't use this kind of variable in this context ..but if I have to create the column in my analysis, I will do that, but it's not really user friendly
Anyway thanks for your time. -
XML attributes makes my query return no rows
Hello everyone,
I've an odd problem.
I'm querying some XML, but the attributes in one of the tags make my query return no rows; if I remove the attributes, then the query works as expected.
The XML is below; it's the attributes in the Report tag that cause the issues:
<result errorCode="0">
<return>
<Report
xsi:schemaLocation="Items_x0020_status_x0020_information http://******-****/ReportServer?%2FReports%2FContent%20Producer%20Reports%2FItems%20status%20information&rs%3AFormat=xml&rc%3ASchema=True"
Name="Items status information" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="Items_x0020_status_x0020_information">
<Tablix1>
<Details_Collection>
<Details ItemId="914P7" Username="test" user_role="IT"
first_name="Barry" last_name="Donovan" organisation=""
content_format="On_Screen" modified_date="26/05/2011 13:16:49"
item_status="Draft" status_date="" component_name="" demand="" />
</Details_Collection>
</Tablix1>
</Report>
</return>
</result>My query is:
select
a.item_id
,a.username
,a.user_role
,a.first_name
,a.last_name
,a.supplier_id
,a.format
,a.modified_date
,a.item_status
,a.completion_date
,a.component_code
from dual
,xmltable
('/result/return/Report/Tablix1/Details_Collection/Details'
passing p_xml
columns
item_id varchar2(1000) path '@ItemId'
,username varchar2(1000) path '@Username'
,user_role varchar2(1000) path '@user_role'
,first_name varchar2(1000) path '@first_name'
,last_name varchar2(1000) path '@last_name'
,supplier_id varchar2(1000) path '@organisation'
,format varchar2(1000) path '@content_format'
,modified_date varchar2(1000) path '@modified_date'
,item_status varchar2(1000) path '@item_status'
,completion_date varchar2(1000) path '@status_date'
,component_code varchar2(1000) path '@demand'
) a;I've tried stripping out the attributes in the tag, which does work, but some of the XML I'm expecting back may be quite large (many records), so that caused issues in itself. I'd rather deal with it and not mess with the XML itself if possible.
Any help would be hugely appreciated!
Thank you very much in advance.
Robin
Edited by: User_resU on Apr 12, 2012 2:50 PMExample:
SQL> ed
Wrote file afiedt.buf
1 with t as (select xmltype('<result errorCode="0">
2 <return>
3 <Report
4 xsi:schemaLocation="Items_x0020_status_x0020_information http://******-****/ReportServer?%2FReports%2FContent%20Producer%20Reports%2FItems%20status%20information&rs%3AFormat=xml&rc%3ASchema=True"
5 Name="Items status information" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6 xmlns="Items_x0020_status_x0020_information">
7 <Tablix1>
8 <Details_Collection>
9 <Details ItemId="914P7" Username="test" user_role="IT"
10 first_name="Barry" last_name="Donovan" organisation=""
11 content_format="On_Screen" modified_date="26/05/2011 13:16:49"
12 item_status="Draft" status_date="" component_name="" demand="" />
13 </Details_Collection>
14 </Tablix1>
15 </Report>
16 </return>
17 </result>') as xml from dual)
18 --
19 -- end of test data
20 --
21 select
22 a.item_id
23 ,a.username
24 ,a.user_role
25 ,a.first_name
26 ,a.last_name
27 ,a.supplier_id
28 ,a.format
29 ,a.modified_date
30 ,a.item_status
31 ,a.completion_date
32 ,a.component_code
33 from t
34 ,xmltable
35 (xmlnamespaces('Items_x0020_status_x0020_information' as "x0"),
36 '//x0:Report/x0:Tablix1/x0:Details_Collection/x0:Details'
37 passing xml
38 columns
39 item_id varchar2(1000) path '@ItemId'
40 ,username varchar2(1000) path '@Username'
41 ,user_role varchar2(1000) path '@user_role'
42 ,first_name varchar2(1000) path '@first_name'
43 ,last_name varchar2(1000) path '@last_name'
44 ,supplier_id varchar2(1000) path '@organisation'
45 ,format varchar2(1000) path '@content_format'
46 ,modified_date varchar2(1000) path '@modified_date'
47 ,item_status varchar2(1000) path '@item_status'
48 ,completion_date varchar2(1000) path '@status_date'
49 ,component_code varchar2(1000) path '@demand'
50* ) a
SQL> /
ITEM_ID
USERNAME
USER_ROLE
FIRST_NAME
LAST_NAME
SUPPLIER_ID
FORMAT
MODIFIED_DATE
ITEM_STATUS
COMPLETION_DATE
COMPONENT_CODE
914P7
test
IT
Barry
Donovan
On_Screen
26/05/2011 13:16:49
Draft
Maybe you are looking for
-
ITunes update won't play playlists
Since I upgraded to version 8...it doesn't allow me to play any of my playlists, particluarly podcasts....it worked fine before!!!!
-
[ORACLE 10G] Extract Long Raw data to disc
Hi All, I want to extract a column which contain long raw data (pdf file) into files on my disque, but i don't know how to do it in SQL or PL/SQL, any help ???
-
Why does my pdf gets bigger in size once i insert data in fields(forms) ?
Hello world, I'm stuck with a very frustrating problem. I have made a presentation in Aftereffects as a pdf and added some editable fields (forms) in Adobe Acrobat Pro. Once i start entering data in the fields and saving the pdf in Adobe Acrobat, the
-
Hi, Could anyone explain me step by step procedure to add dataset from RSS feed? My main concern is how will I create a dedicated RSS feed and sync it with my R/3 to fetch data from it? Cordially, Danish
-
AVCHD Imported video Jitters and Jumps
Ok I know this has been discussed however I cant seem to get the log and transfer process to create files that are not horribly jittery. Every second there is a major jump during playback. I have a Sony SR1. Easy setup at AIC 1080i60 File properties