Query XML giving NULL result - please help!
HelloI am a newbie in XML and I try to extract the XMLType column information.
I am using Oracle 11g
I use the table is
CREATE TABLE 'PRODUCTS '.
(
'ID' VARCHAR2 (10 BYTE),
"CUSTDOC" 'SYS '. "" XMLTYPE.
)
_________________________________________________________________
I am the slot loading XML file in the CUSTDOC column
< report xmlns = "http://developer.cognos.com/schemas/report/6.0/."
expressionLocale = "en - to the" >
[< modelPath > / content/folder[@name='Packages']/folder[@name='Prod']/package[@name='ORGS']/model[@name='model'] < / modelPath >
< drillBehavior modelBasedDrillThru = "true" / >
< query >
< application name = "Query1" >
< source >
< model / >
< / source >
< selection >
< name of dataItem = aggregate 'Incident ID' = 'none' rollupAggregate = 'none' >
< expression > [ABC]. [XYZ]. [Incident] < / expression >
< / dataItem >
< / selection >
< detailFilters >
< detailFilter >
< filterExpression > [ABC]. [XYZ]. [Company] = "SOCIÉTÉTEST" < / filterExpression >
< / detailFilter >
< / detailFilters >
< / query >
< / queries >
< layouts >
< layout >
< reportPages >
< name = 'Page1' page >
< style >
< defaultStyles >
< defaultStyle = "pg" refStyle / >
< / defaultStyles >
< / style >
< pageBody >
< style >
< defaultStyles >
< defaultStyle = "pb" refStyle / >
< / defaultStyles >
< / style >
< content >
< refQuery list = "Query1" horizontalPagination = "true" name = "List1" >
< style >
< defaultStyles >
< defaultStyle = 'ls' refStyle / >
< / defaultStyles >
< value CSS = "border-collapse: collapse" / >
< / style >
< more >
< listColumn >
< listColumnTitle >
< style >
< defaultStyles >
< defaultStyle = 'lt' refStyle / >
< / defaultStyles >
< / style >
< content >
< textItem >
< dataSource >
< dataItemLabel refDataItem = "The Incident ID" / >
< / dataSource >
< / textItem >
< / Summary >
< / listColumnTitle >
< listColumnBody >
< style >
< defaultStyles >
< defaultStyle = 'lc' refStyle / >
< / defaultStyles >
< / style >
< content >
< textItem >
< dataSource >
< dataItemValue refDataItem = "The Incident ID" / >
< / dataSource >
< / textItem >
< / Summary >
< / listColumnBody >
< / listColumn >
< / more >
< / list >
< / Summary >
< / pageBody >
< Entetepage >
< content >
< block >
< style >
< defaultStyles >
< defaultStyle = 'ta' refStyle / >
< / defaultStyles >
< / style >
< content >
< textItem >
< style >
< defaultStyles >
< defaultStyle = "tt" refStyle / >
< / defaultStyles >
< / style >
< dataSource >
< staticValue / >
< / dataSource >
< / textItem >
< / Summary >
< / block >
< / Summary >
< style >
< defaultStyles >
< defaultStyle = "ph" refStyle / >
< / defaultStyles >
< value = CSS "padding-bottom: 10px" / >
< / style >
< / pageHeader >
< pageFooter >
< content >
< table >
< tableRows >
< tableRow >
< tableCells >
< tableCell >
< content >
< date >
< style >
< dataFormat >
< dateFormat / >
< / dataFormat >
< / style >
< / date >
< / Summary >
< style >
< value="vertical-align:top;text-align:left;width:25%"/ CSS >
< / style >
< / tableCell >
< tableCell >
< content >
< pageNumber / >
< / Summary >
< style >
< value="vertical-align:top;text-align:center;width:50%"/ CSS >
< / style >
< / tableCell >
< tableCell >
< content >
< time >
< style >
< dataFormat >
< timeFormat / >
< / dataFormat >
< / style >
< / time >
< / Summary >
< style >
< value="vertical-align:top;text-align:right;width:25%"/ CSS >
< / style >
< / tableCell >
< / tableCells >
< / tableRow >
< / TableRow >
< style >
< defaultStyles >
< defaultStyle = "CT" refStyle / >
< / defaultStyles >
< value="border-collapse:collapse;width:100%"/ CSS >
< / style >
< /table >
< / Summary >
< style >
< defaultStyles >
< defaultStyle = "pf" refStyle / >
< / defaultStyles >
< value = CSS "padding-top: 10px" / >
< / style >
< / pageFooter >
< / print this page >
< / reportPages >
< / page layout >
< / page layout >
< XMLAttributes >
< name XMLAttribute = "RS_CreateExtendedDataItems" value = "true" output = "no" / >
< name XMLAttribute = "listSeparator' value = ',' output ="no"/ >
< / XMLAttributes >
< / report >
____________________________________________________________________________________
I run the query below
SELECT SYS. XMLTYPE. GETCLOBVAL (SYS. XMLTYPE. Extract ("CUSTDOC",'/ Report/Queries/Query/Selection/DataItem/expression / Text () ')) 'CUSTDOC' OF 'PRODUCT '.
and I await the result below
CUSTDOC
---
[ABC]. [XYZ]. [Incident]
but I am NOTHING.
Please help me. Don't know what I'm doing wrong here.
Kind regards
Ravi
Hi Ravi,
Don't know what I'm doing wrong here.
Two things:
-EXTRACT function is deprecated--> use XMLQuery or XMLTable rather
-You are missing the namespace declaration
See if it works for you:
SQL> SELECT XMLCast(
2 XMLQuery(
3 'declare default element namespace "http://developer.cognos.com/schemas/report/6.0/"; (: :)
4 /report/queries/query/selection/dataItem/expression'
5 passing t.custdoc
6 returning content
7 )
8 as varchar2(30)
9 ) as expr
10 FROM product t ;
EXPR
------------------------------
[ABC].[XYZ].[Incident]
Tags: Oracle Development
Similar Questions
-
Query with Cartesian product result - please help
SELECT count (distinct e.hiredate), e scott.emp count(distinct b.hiredate), b scott.emp where e.hiredate < to_date('01-DEC-80','DD-MON-YY') and b.hiredate < to_date('23-JUN-81','DD-MON-YY')Hello
Change the format AA to RR as itemSELECT SUM(case when hiredate < TO_DATE ('01-DEC-80', 'DD-MON-RR') then 1 else 0 end) one ,SUM(case when hiredate < TO_DATE ('23-JUN-81', 'DD-MON-RR') then 1 else 0 end) two FROM scott.emp
Sven W., you are fast enough for me
Published by: Anthony Alix on March 26, 2009 03:34
-
need to query to find repeating values, please help
I need assistance with SQL or what you think are the best way to do it, maybe PL/SQL.
Basically it like that, in the 10G database, there are two address field:
ADDESS_DELVRY - mailing address for example would be stored here
ADDESS_DELVRY2 - building to apartments, away or PBM number would be stored here
but sometimes I see the apartment B-123 in these two areas, so I need to find the duplicates, if there is a way.
Thus, for example:
ADDESS_DELVRY - 123 Elm Street Apartment 2B
ADDESS_DELVRY2 - apartment 2B
It's a problem, because then the apartment is printed twice on the mail piece. I think there is a small percentage who have this problem and I'm trying to find the best way to their ID, maybe use REG_EXP?
Not sure, please help, thanks!Kodiak_Seattle wrote:
If there is no luck there is a % or _ how is the request?SELECT *.
FROM table_x
WHERE the address_delvry LIKE "| address_delvry2;?
Nothing found.
ATTENTION: you need the Joker '% '.
The above condition is identical to
WHERE address_delvry = address_delvry2
Try it with the wildcard '% ':
WHERE address_delvry LIKE '%' -- The % is very iomportant! || address_delvry2
I think that the suggestion of Srini (INSTR) will be more effective, if a little more complicated to code.
-
need help with query can find data back please help.
Hi guys I have a table such as
and I have a data as suchCREATE TABLE "FGL" ( "FGL_GRNT_CODE" VARCHAR2(60), "FGL_FUND_CODE" VARCHAR2(60), "FGL_ACCT_CODE" VARCHAR2(60), "FGL_ORGN_CODE" VARCHAR2(60), "FGL_PROG_CODE" VARCHAR2(60), "FGL_GRNT_YEAR" VARCHAR2(60), "FGL_PERIOD" VARCHAR2(60), "FGL_BUDGET" VARCHAR2(60) )
I need bascially to get the total of the budget column. However this is not as simple as it sounds good (at least not for the me.) totals carried forward to the new period. you will notice that you have a period column. Basically, what im is thatInsert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','11','1','400'); Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','10','1','100'); Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','1','0'); Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','14','200'); Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','10','14','100'); Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','10','2','100'); Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7470','4730','02','10','2','200');
fgl_grant_year 10 1 period = account 7600 its $100 and $100 for the period 2, you see $ 100 more, it wants to not be added to this is the door on the balance. that is $100.
So im trying to write a query that basically does the following.
IM considering a period for the sake of this example let period 1 I get anything else. I find that the greates contributes dumpster year the amount for the period 14 (which corresponds to the total of the previous year) and add it to the amount of the current year. in this case period 1 grnt_year 11
the expected result is therefore $700
do not forget that I am not given a just a period of the year.240055 240055 7240 4730 02 10 14 200 240055 240055 7600 4730 02 10 14 100 240055 240055 7600 4730 02 11 1 400
any help you guys can give would be immensely appreciated. I tried to get this to work for more than 3 days now.
Finally broke down and put together this post
Published by: mlov83 on Sep 14, 2011 20:48Hello
Thanks for posting the CREATE TABLE and INSERT statemnts; It is very useful.
I'm not sure that understand your needs.
The correct output will be just one line:TOTAL_BUDGET ------------ 700
or will it be 3 ranks that you posted? I guess you want just line after line.
Do you mean that you are given a period (for example, 1).
First you have to find the largest gfl_grnt_year which is related to this period (in this case, 11).
Then you need to add fgl_budget lines that have to be
(1) the specific period and the largest fgl_grnt_year, or
(2) perriod = 14 and the previous fgl_grnt_year (in this case, 10).
Is this fair?If so, here's a way to do it:
WITH got_greatest_year AS ( SELECT fgl.* -- or whatever columns are needed , MAX ( CASE WHEN fgl_period = :given_period THEN fgl_grnt_year END ) OVER () AS greatest_year FROM fgl ) SELECT SUM (fgl_budget) AS total_budget -- or SELECT * FROM got_greatest_year WHERE ( fgl_grnt_year = greatest_year AND fgl_period = :given_period ) OR ( fgl_grnt_year = greatest_year - 1 AND fgl_period = 14 ) ;
If you want the 3 lines you have posted, then change the main SELECT clause to ' SELECT * ' (or, instead of *, youcan the columns you want to see the list).
-
Show all records in the search results, please help
I have this before posting, but had no chance I used my script to search before but tried again and he's back ALL results of the DB... Can you see what I'm missing?
$var_SalaryReq_Recordset1 = '% ';
If (isset($_GET['SalaryReq'])) {}
$var_SalaryReq_Recordset1 = $_GET ['SalaryReq'];
}
$var_skills_offered_Recordset1 = '% ';
If (isset($_GET['skills_offered'])) {}
$var_skills_offered_Recordset1 = $_GET ['skills_offered'];
}
$var_location_Recordset1 = '% ';
If (isset($_GET['location'])) {}
$var_location_Recordset1 = $_GET ['location'];
}
$var_PositionReq_Recordset1 = '% ';
If (isset($_GET['PositionReg'])) {}
$var_PositionReq_Recordset1 = $_GET ['PositionReg'];
}
@mysql_select_db ($database_hostprop, $hostprop);
$query_Recordset1 = sprintf ("SELECT username, name, surname, SalaryReq, PositionReq, location, otherComments, skills_offered FROM think_signup WHERE SalaryReq LIKE %s or PositionReq AS location, AS GOLD skills_offered GOLD AS %s %s %s", GetSQLValueString ("%". ") $var_SalaryReq_Recordset1. '%', 'text'), GetSQLValueString ('%'. $var_PositionReq_Recordset1.) '%', 'text'), GetSQLValueString ('%'. $var_location_Recordset1.) ('%', 'text'), GetSQLValueString ('%'. $var_skills_offered_Recordset1, "text"));
$query_limit_Recordset1 = sprintf ("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query ($query_limit_Recordset1, $hostprop) or die (mysql_error ());
$row_Recordset1 = mysql_fetch_assoc ($Recordset1);
the search fields are
< input name = "PositionReq" type = "text" class = "textfeilds" value = "Job title" size = "32" / >
< input name = "skills_offered" type = "text" class = "textfeilds" value = "Required skills" size = "32" / >
< input name = "SalaryReq" type = "text" class = "textfeilds" value = "Salary offered" size = "32" / >
< input name = "location" type = "text" class = "textfeilds" value = "Location" size = "32" / >
Thanks in advance
Sorry, just need a push of foot. "%"
Thanks for the prompt.
concerning
-
Ask help - please help me get the expected defined in a query result
Dear all,
Help with your suggestions and advice. Please see the bottom of the screenshots for the planned result sets.
create table shift_dt (name varchar2(20), shift_start date, shift_end date); insert into shift_dt values ('Brian',to_date('01-01-2015 09:10:00','dd-mm-yyyy hh24:mi:ss'), to_date('01-01-2015 22:10:00','dd-mm-yyyy hh24:mi:ss')); insert into shift_dt values ('Brian',to_date('02-01-2015 09:10:00','dd-mm-yyyy hh24:mi:ss'), to_date('04-01-2015 00:00:00','dd-mm-yyyy hh24:mi:ss')); insert into shift_dt values ('Brian',to_date('04-01-2015 00:00:00','dd-mm-yyyy hh24:mi:ss'), to_date('05-01-2015 15:20:00','dd-mm-yyyy hh24:mi:ss')); insert into shift_dt values ('Brian',to_date('06-01-2015 10:00:00','dd-mm-yyyy hh24:mi:ss'), to_date('06-01-2015 23:20:00','dd-mm-yyyy hh24:mi:ss')); insert into shift_dt values ('Brian',to_date('07-01-2015 11:00:00','dd-mm-yyyy hh24:mi:ss'), to_date('09-01-2015 00:00:00','dd-mm-yyyy hh24:mi:ss')); insert into shift_dt values ('Brian',to_date('09-01-2015 00:00:00','dd-mm-yyyy hh24:mi:ss'), to_date('10-01-2015 22:00:00','dd-mm-yyyy hh24:mi:ss')); select * from shift_dt;
Select * from shift_dt;
Expected result set: -.
I compare date of shift_end with the next date of shift_start of the day. If the dates made 12 am (IE 00:00:00), then I ignore and display the next shift end date available as displayed in the screen game result. Please see the screen set outcome turned for more details.
Please help get the results you want in the SQL query
Kind regards
Souls
Hello
Here's one way:
WITH got_new_grp AS
(
SELECT name, shift_start, shift_end
CASE
WHEN shift_start = TRUNC (shift_start)
AND shift_start = LAG (shift_end) OVER (ORDER BY shift_start)
THEN 0
1. OTHER
END AS new_grp
OF shift_dt
)
got_grp AS
(
SELECT name, shift_start, shift_end
SUM (new_grp) OVER (ORDER BY shift_start) AS grp
OF got_new_grp
)
SELECT MIN (name) DUNGEON (DENSE_RANK FIRST ORDER BY shift_start)
As a name
MIN (shift_start) AS shift_start
MAX (shift_end) AS shift_end
OF got_grp
GROUP BY grp
ORDER BY shift_start
;
Output (from the full sample data):
NAME SHIFT_START SHIFT_END
-------------------- ---------------- ----------------
01/01/2015 Brian 09:10 01/01/2015 22:10
Brian 02/01/2015 09:10 01/05/2015 15:20
Brian 06/01/2015 10:00 01/06/2015 23:20
Brian 07/01/2015 11:00 10/01/2015 22:00
Brian 01/02/2015 15:00 02/02/2015 00:00
Brian 02/02/2015 11:00 02/02/2015 17:00
Brian 03/02/2015 00:00 03/02/2015 08:00
Brian 02/05/2015 15:30 06/02/2015 07:30
Brian 07/02/2015 23:30 10/02/2015 00:30
I guess that shift_start is unique.
It's finally a GROUP BY problem: we want to show the first shift_start and the last shfit_end of a group of 1 or more lines. The tricky part is to identify the groups. If I understand the problem, line X is grouped with the previous line X-1 if shift_start on the X line is midnight and is equal to shift_end on line X-1. The above query uses the LAG analytic to see if each line begins a new group or not and the analytic function SUM to see how many groups have already begun (and therefore, which group each line entry belongs.)
I still don't understand why you 'Corrected name of Anne in Brian' and not vice versa. I guess the name to display in each group is the name of the first row in the Group (i.e. the line with the shift_start earlier).
-
I have problem with value NULL when the use CASE statement please help this question
I have problem with value NULL when the use CASE statement please help this question
Table: digital_val
SNO cl C2
1 San1 11
2 22 San2
Actual result: expected to A B
A B 11 22
11 NULL
22 NULL
query:
Select case when c1 = "san1" then c2,.
case If c1 = "san2" then c2 B
of digital_val
I'm more curious why, when you select 2 rows, you expect a result of row?
WITH digital_val
AS (SELECT 1 AS 'Sno', 'San1"C1, c2 FROM DUAL 11)
UNION ALL
2 SELECT AS 'Sno', 'San2"C1, c2 FROM DUAL 22)
SELECT CASE WHEN c1 is "San1" THEN END AS A c2.
CASE WHEN c1 = "San2" THEN END AS B c2
OF digital_val;
With no other input, if you select 2 rows, you get 2 rows. One of the other solutions use a max function, but is this really what you want, does not specify?
-
Hi, I want to display the number of success / testing failed in the Testtand of xml report, please help me.
Later, my requirement is that I should be able to view the number of test / has not passed in the header of the report too.
I have attached a sequence to give you an idea of how to get the number of results (I don't check it works ), I used 'SequenceFilePostResultListEntry' callback to calculate the number of results.
and the number of results is passed to the 'ModifyReportHeader' through Globals files, where you can edit the XML file to display in the Repot (follow the link in my previous post).
Hope this helps
AshwiN,
-
Please help me find the solution for the query
Hi Experts,
Please help build a sql query. Thank you
Examples of data
-------------------
create the table Material_tb
(
Detail varchar2 (20).
Description varchar2 (200)
)
/
Start
Insert into material_tb values('Color','Red,Blue,Black,Green,White');
Insert into material_tb values ('Material','Gold, Silver, Platinum');
end;
/
Select * from material_tb;
DETAIL DESCRIPTION
-------------------- ------------------------------
Color red, blue, black, green, white
Material gold, silver, Platinum
I want that output voltage
DETAIL DESCRIPTION
-------------------- ------------------------------
Red color
Blue color
Black color
Green color
White color
Material gold
Silver material
Platinum material
You can try under sql
select distinct detail,regexp_substr(description,'[^,]+',1,LEVEL) from material_tb connect by regexp_substr(description,'[^,]+',1,LEVEL) is not null order by 1
-
Hello
Please help build a sql query
My Table Test2015 has given belowHeader_id Line_id Ordered_item
723887290 199925 MAIN1
199925 723887291 MAIN2
199926 723887292 SH-POS-NO-BR POS-INS
199926 723887293 MAIN2
199927 723887294 IC-ENV-NON-BR-ENV-PXY
199927 723887295 MAIN1
199927 723887297 MAIN2
199927 723887298 PRCSS SH-FAIRY-ELEC DISTR.
199927 723887299 SH-FAIRY-SUM PRO-DE-CONS-HOUSE
I am trying to query my Test2015 table to obtain the records with ordered_item containing 'MAIN1' and 'MAIN2' only. I tried to write a query as below
SELECT * FROM test2015 WHERE ORDERED_ITEM in ('MAIN1', 'MAIN2');
But it gives me all the data with the MAIN2 records found but MAIN1 is absent, I want to retrieve only records to both 'MAIN1' and 'MAIN2' present for Header_id.
While the result below shows me header_id - 199926 and 199929 that he should assume back. I want to fetch documents only with 'MAIN1' and 'MAIN2' both present.
Header_id Line_id Ordered_item
723887290 199925 MAIN1
199925 723887291 MAIN2
199926 723887293 MAIN2
199927 723887295 MAIN1
199927 723887297 MAIN2
199929 723887299 MAIN1
Please suggest.
Thank you and best regards,
Prasad.
Hello
Try like this...
SELECT * FROM test2015 WHERE ORDERED_ITEM in ('MAIN1") and in header_id (select test2015 WHERE ORDERED_ITEM in ('MAIN2') header_id)
-
Please help to read the XML with XMLTable
Hi gurus,
I'm not very familiar with XML parsing. It seems to me that it should be very easy to get the data. For some reason, I'm having a problem to get the data.
SELECT *.
OF e util.hlsr_online_entries,.
XMLTABLE)
XmlNamespaces)
' http://tempuri.org/ ' as "dt",
("urn: schemas-microsoft-com: XML-diffgram-v1" as "dg")."/ DataTable / dg:diffgram/DocumentElement/JrShowCustomerHeifers.
PASSAGE XMLTYPE (e.entry_data)
COLUMNS
SeqNo TO the ORDINALITE,
DocumentID NUMBER PATH "DocumentID",.
PATH of VARCHAR2 (100) ClubName "ClubName") as test
WHERE e.ref_id = 33422The query above does all the data for me. My hunts is the problem with the tab DocumentElement. I tried a different variant management.
Please help me to resolve the application
I have the XML document following the DotNet developer
<? XML version = "1.0" encoding = "utf-8"? >
" < DataTable xmlns =" http://tempuri.org/ ">
< xs: Schema id = "NewDataSet" xmlns = "" "xmlns: XS =" " http://www.w3.org/2001/XMLSchema " "xmlns:msdata ="urn: schemas-microsoft-com: xml-msdata" >
< xs: element name = "NewDataSet" msdata:IsDataSet = "true" msdata:MainDataTable = "JrShowCustomerHeifers" msdata:UseCurrentLocale = "true" >
< xs: complexType >
< xs: Choice minOccurs = "0" maxOccurs = "unbounded" >
< xs: element name = "JrShowCustomerHeifers" >
< xs: complexType >
< xs: SEQUENCE >
< xs: element name = "DocumentID" type = "xs: int" minOccurs = "0" / >
< xs: element name = "ClubName" type = "xs: String" minOccurs = "0" / >
< xs: element name = "Name" type = "xs: String" minOccurs = "0" / >
< xs: element name = "FirstName" type = "xs: String" minOccurs = "0" / >
< xs: element name = "PreferredName" type = "xs: String" minOccurs = "0" / >
< xs: element name = "Email" type = "xs: String" minOccurs = "0" / >
< xs: element name = "Exhibitor" type = "xs: String" minOccurs = "0" / >
< xs: element name = "AnimalName" type = "xs: String" minOccurs = "0" / >
< xs: element name = "RegistryNo" type = "xs: String" minOccurs = "0" / >
< xs: element name = "DateofBirth" type = "xs: String" minOccurs = "0" / >
< xs: element name = "NameofSire" type = "xs: String" minOccurs = "0" / >
< xs: element name = "SireRegistryNo" type = "xs: String" minOccurs = "0" / >
< xs: element name = "NameofDam" type = "xs: String" minOccurs = "0" / >
< xs: element name = "DamRegistryNo" type = "xs: String" minOccurs = "0" / >
< xs: element name = "Tattoo" type = "xs: String" minOccurs = "0" / >
< xs: element name = "SecondaryTattoo" type = "xs: String" minOccurs = "0" / >
< xs: element name = "UniversalIDNumber" type = "xs: String" minOccurs = "0" / >
< xs: element name = "Tattoo_Location" type = "xs: String" minOccurs = "0" / >
< xs: element name = "Secondary_Tattoo_Location" type = "xs: String" minOccurs = "0" / >
< xs: element name = "OracleBreedID" type = "xs: int" minOccurs = "0" / >
< xs: element name = "JrValidationBreedName" type = "xs: String" minOccurs = "0" / >
< xs: element name = "ValidationDate" type = "xs: DateTime" minOccurs = "0" / >
< xs: element name = "ValidatedBy" type = "xs: String" minOccurs = "0" / >
< xs: element name = "ValidationComment" type = "xs: String" minOccurs = "0" / >
< / xs: SEQUENCE >
< / xs: complexType >
< / xs: element >
< / xs: Choice >
< / xs: complexType >
< / xs: element >
< / xs: Schema >
< xmlns:msdata = diffgr:diffgram "" urn: schemas-microsoft-com: xml-msdata "xmlns:diffgr =" urn: schemas-microsoft-com: XML-diffgram-v1 ">"
< DocumentElement xmlns = "" >
< JrShowCustomerHeifers diffgr: ID = "JrShowCustomerHeifers1" msdata:rowOrder = "0" >
< > 18442 DocumentID < / DocumentID >
< ClubName > Perrin FFA < / ClubName >
Hamman < name > < / LastName >
< FirstName > Charles < / name >
< email > [email protected] < / email >
< setting > hammam, Charles < / Exhibitor >
< > 113 AnimalName < / AnimalName >
< RegistryNo > C1026447 < / RegistryNo >
< DateofBirth > 14/01/2013 < / DateofBirth >
< NameofSire > 808 808 DAYS of MATCH LH < / NameofSire >
< SireRegistryNo > C961101 < / SireRegistryNo >
SADIE 7/7 < NameofDam > < / NameofDam >
< DamRegistryNo > C941067 < / DamRegistryNo >
< > 113 tattoo < / tattoo >
< SecondaryTattoo / >
< UniversalIDNumber > 1194F020 < / UniversalIDNumber >
< Tattoo_Location > TATTOO - left ear < / Tattoo_Location >
< Secondary_Tattoo_Location / >
< OracleBreedID > 6383 < / OracleBreedID >
Beefmaster < JrValidationBreedName > < / JrValidationBreedName >
< ValidationDate > 2014-11-25T 08: 39:00 - 06:00 < / ValidationDate >
< ValidatedBy > laineyb < / ValidatedBy >
< ValidationComment / >
< / JrShowCustomerHeifers >
< JrShowCustomerHeifers diffgr: ID = "JrShowCustomerHeifers2" msdata:rowOrder = "1" >
< > 18473 DocumentID < / DocumentID >
< ClubName > Perrin FFA < / ClubName >
Hamman < name > < / LastName >
< FirstName > Charles < / name >
< email > [email protected] < / email >
< setting > hammam, Charles < / Exhibitor >
< AnimalName > PURPLE CORALEE 349 KPH < / AnimalName >
< RegistryNo > P43461953 < / RegistryNo >
< DateofBirth > 04/11/2013 < / DateofBirth >
< NameofSire > PURPLE MOXY 22 X AND < / NameofSire >
< SireRegistryNo > P43126458 < / SireRegistryNo >
< NameofDam > TCC CORKY 6603 < / NameofDam >
< DamRegistryNo > P42457119 < / DamRegistryNo >
< > 349 tattoo < / tattoo >
< SecondaryTattoo > km/h < / SecondaryTattoo >
< UniversalIDNumber > 1194F021 < / UniversalIDNumber >
< Tattoo_Location > TATTOO - left ear < / Tattoo_Location >
< Secondary_Tattoo_Location > TATTOO - right ear < / Secondary_Tattoo_Location >
< OracleBreedID > 6389 < / OracleBreedID >
< JrValidationBreedName > Polled Hereford < / JrValidationBreedName >
< ValidationDate > 2014 - 12-01 T 11: 55:00 - 06:00 < / ValidationDate >
Hannah < ValidatedBy > < / ValidatedBy >
< ValidationComment / >
< / JrShowCustomerHeifers >
< JrShowCustomerHeifers diffgr: ID = "JrShowCustomerHeifers3" msdata:rowOrder = "2" >
< > 18474 DocumentID < / DocumentID >
< ClubName > Perrin FFA < / ClubName >
Hamman < name > < / LastName >
< FirstName > Charles < / name >
< email > [email protected] < / email >
< setting > hammam, Charles < / Exhibitor >
< AnimalName > LANGFORDS SWEET N SOUR 4107 < / AnimalName >
< RegistryNo > 43504761 < / RegistryNo >
< DateofBirth > 02/03/2014 < / DateofBirth >
< NameofSire > LH TNT 1017 < / NameofSire >
< SireRegistryNo > 43199794 < / SireRegistryNo >
< NameofDam > LANGFORDS LADY 2206 AND < / NameofDam >
< DamRegistryNo > 43315143 < / DamRegistryNo >
< > 4107 tattoo < / tattoo >
< SecondaryTattoo / >
< UniversalIDNumber > 1194F018 < / UniversalIDNumber >
< Tattoo_Location > TATTOO - left ear < / Tattoo_Location >
< Secondary_Tattoo_Location / >
< OracleBreedID > 6398 < / OracleBreedID >
Hereford < JrValidationBreedName > < / JrValidationBreedName >
< ValidationDate > 2014-11-24T 14:26:00 - 06:00 < / ValidationDate >
Validator < ValidatedBy > < / ValidatedBy >
< ValidationComment / >
< / JrShowCustomerHeifers >
< JrShowCustomerHeifers diffgr: ID = "JrShowCustomerHeifers4" msdata:rowOrder = "3" >
< > 18475 DocumentID < / DocumentID >
< ClubName > Perrin FFA < / ClubName >
Hamman < name > < / LastName >
< FirstName > Charles < / name >
< email > [email protected] < / email >
< setting > hammam, Charles < / Exhibitor >
< AnimalName > PURPLE CCC 19A LYDIA < / AnimalName >
< RegistryNo > P43406978 < / RegistryNo >
< DateofBirth > 05/02/2013 < / DateofBirth >
< NameofSire > PURPLE MB WOMANIZER 14UET < / NameofSire >
< SireRegistryNo > P42945146 < / SireRegistryNo >
< NameofDam > PURPLE CMCC NASTIA 9U < / NameofDam >
< DamRegistryNo > P42927201 < / DamRegistryNo >
< > 19A tattoo < / tattoo >
< SecondaryTattoo / >
< UniversalIDNumber > 1194F017 < / UniversalIDNumber >
< Tattoo_Location > TATTOO - left ear < / Tattoo_Location >
< Secondary_Tattoo_Location / >
< OracleBreedID > 6389 < / OracleBreedID >
< JrValidationBreedName > Polled Hereford < / JrValidationBreedName >
< ValidationDate > 2014 - 12-01 T 11: 55:00 - 06:00 < / ValidationDate >
Hannah < ValidatedBy > < / ValidatedBy >
< ValidationComment / >
< / JrShowCustomerHeifers >
< JrShowCustomerHeifers diffgr: ID = "JrShowCustomerHeifers5" msdata:rowOrder = "4" >
< > 18477 DocumentID < / DocumentID >
< ClubName > Perrin FFA < / ClubName >
Hamman < name > < / LastName >
< FirstName > Charles < / name >
< email > [email protected] < / email >
< setting > hammam, Charles < / Exhibitor >
< AnimalName > PURPLE SGW EDEN 12 b < / AnimalName >
< RegistryNo > P43521932 < / RegistryNo >
< DateofBirth > 02/04/2014 < / DateofBirth >
< NameofSire > first TIME's a WASTINe 0124 < / NameofSire >
< SireRegistryNo > 43123163 < / SireRegistryNo >
< NameofDam > PURPLE SM WONDER WOMAN 160Y < / NameofDam >
< DamRegistryNo > P43235169 < / DamRegistryNo >
< tattoo > 12 b < / tattoo >
< SecondaryTattoo > 12 b < / SecondaryTattoo >
< UniversalIDNumber > 1194F015 < / UniversalIDNumber >
< Tattoo_Location > TATTOO - left ear < / Tattoo_Location >
< Secondary_Tattoo_Location > TATTOO - right ear < / Secondary_Tattoo_Location >
< OracleBreedID > 6389 < / OracleBreedID >
< JrValidationBreedName > Polled Hereford < / JrValidationBreedName >
< ValidationDate > 2014 - 12-01 T 11: 56:00 - 06:00 < / ValidationDate >
Hannah < ValidatedBy > < / ValidatedBy >
< ValidationComment / >
< / JrShowCustomerHeifers >
< / DocumentElement >
< / diffgr:diffgram >
< / DataTable >
user12021633 wrote:
Regarding your suggestion, I've never used the syntax of FLWOR. I'll try to implement if I can make it work.
"FLWOR is the abbreviation of ' for Let's where Order by Return" and refers to the full form of an XQuery query expression.
Do you think it would be faster than the way I have the values?
You have used a FLWOR expression (the 'for' + 'return' part of it) in this post: Re: Please help to read the XML with XMLTable
And I have already said: do not use in this case.
Faster or slower isn't the point. Oracle will evaluate the expression in the same way.
But from a maintenance point of view, it's obviously much easier to use a simple XPath expression like this:
/DT:GetJrShowCustomerHeifersResponse / dt:GetJrShowCustomerHeifersResult / dg:diffgram/DocumentElement/JrShowCustomerHeifers
-
Hello
I have an emp_job_det with a, b, c columns table. Note that this TABLE ALREADY has DATA OF THESE COLUMNS
IAM now add a new column "D" with forced not null
Fistly I alter the table by adding the single column "D", if I do, the entire column would be created with alll of nulls for the column DEFAULT D
ALTER table emp_job_det Add number D; -do note not null CONSTRAINT is not added
Second... If I try to add the constraint not null, get an eoor as already conatained null values...
(GOLD)
In other words, if I put the query
ALTER table emp_job_det Add number D NOT NULL; -THROWS ERROR AS TABLE ALREADY CONTAINS DATA
So my question is how how can I add a new column with a constraint not null, table already has the data, without falling off the table
Please help me on this issue...
Add the column without constraint, then fill the column. Once all the rows in the table are given in the new column, and then add the constraint not null.
-
Please, help me to query SQL Construct.
Hi Experts,Could you please help me to query SQL Construct. Please find the details
HOSTNAME HOSTTYPE DEM R1 R2
RS123 P ABC 24.5 265,5RS123 P CYC 24.5 265,5
RS123 P ADDS 24.5 265,5
RS123 P ADE 24.5 265,5
RS123 P SRC 24.5 265,5
EXPECTED RESULTS
HOSTNAME HOSTTYPE MNE R1 R2
RS123 P ABC, CYC, ADD, ADE, CBC 24.5 265,5Concerning
See you soon
with t as)
Select "RS123' hostname 'P' hosttype, 'ABC' dem, 24.5 r1, r2 265,5 Union double all the
Select 'RS123', 'P', "CYC", 24.5, 265,5 double Union all
Select 'RS123', 'P', 'ADD', 24.5, 265,5 double Union all
Select "RS123', 'P', 'ADE', 24.5, 265,5 double Union all
Select 'RS123', 'P', 'SRC', 24.5, 265,5 double
)
Select the host name,
HostType,
RTrim (XMLAGG (XmlElement(e,MNE,','). (Extract ('//Text ()')), ',') DEM,.
R1,
R2
t
Group hostname,
HostType,
R1,
R2
/
HOSTN H DEM R1 R2
----- - -------------------- ---------- ----------
RS123 P ABC, CBC, ADE, ADD, CYC 24.5 265,5SQL >
SY.
-
My requirement is to calculate a few things like total_cash_amount, TOTAL_CO_PATIENT_AMOUNT etc... For this we will use BILLING. PATIENTBILL, BILLING. PATIENTBILLDETAILS, BILLING. Operating tables. Here it is already developed procedure.
I'm askd to change the same for best performance. This is the part of it that is calculation of total_cash_amount. There will be two categories such as INPATIENT (IP) and OUTPATIENT (OP). Can anyone of you please help me to change the code in a manner better. And can you please suggest that global temporary tables are better or can we use the tables directly.
Thanks in advance...INSERT INTO GTT_PATIENTBILL SELECT * FROM BILLING.PATIENTBILL P WHERE P.LOCATIONID = IN_LOCATIONID AND TRUNC(P.BILLDATE) BETWEEN TRUNC(IN_YEARDATE) AND TRUNC(IN_FROMDATE); INSERT INTO GTT_PATIENTBILLDETAILS SELECT PB.* FROM BILLING.PATIENTBILL P, BILLING.PATIENTBILLDETAILS PB WHERE P.LOCATIONID = IN_LOCATIONID AND P.BILLNO = PB.BILLNO AND TRUNC(P.BILLDATE) BETWEEN TRUNC(IN_YEARDATE) AND TRUNC(IN_FROMDATE); INSERT INTO GTT_TRANSACTION SELECT * FROM BILLING.TRANSACTION T WHERE T.LOCATIONID = IN_LOCATIONID AND TRUNC(T.CREATEDDATE) BETWEEN TRUNC(IN_YEARDATE) AND TRUNC(IN_FROMDATE); DELETE FROM TEMP_1; INSERT INTO TEMP_1 SELECT (CASE WHEN PARTICULARS IS NULL AND FLG = 1 THEN 'TOTAL COLLECTIONS' WHEN PARTICULARS IS NULL AND FLG = 2 THEN 'TOTAL DEDUCTIONS' ELSE PARTICULARS END) PARTICULARS, SUM(A) "FOR THE DAY", SUM(B) "MONTH TO DATE", SUM(C) "YEAR TO DATE" FROM (SELECT PARTICULARS, SUM(TOTAL_CASH_AMOUNT_DAY) A, SUM(TOTAL_CASH_AMOUNT_MONTH) B, SUM(TOTAL_CASH_AMOUNT_YEAR) C, 1 FLG FROM (SELECT 'OP CASH' PARTICULARS, SUM(P.TOTALSERVICEAMOUNT) TOTAL_CASH_AMOUNT_DAY, 0 TOTAL_CASH_AMOUNT_MONTH, 0 TOTAL_CASH_AMOUNT_YEAR FROM GTT_PATIENTBILL P--BILLING.PATIENTBILL P, BILLING.PATIENTBILLDETAILS PB WHERE P.LOCATIONID = IN_LOCATIONID --AND P.BILLNO = PB.BILLNO AND P.BILLINGTYPEID = 1 AND P.PATIENTSERVICE = 2 AND TRUNC(P.BILLDATE) =TRUNC(IN_FROMDATE) UNION ALL SELECT 'OP CASH' PARTICULARS, 0, SUM(P.TOTALSERVICEAMOUNT) TOTAL_CASH_AMOUNT_MONTH, 0 FROM GTT_PATIENTBILL P--BILLING.PATIENTBILL P, BILLING.PATIENTBILLDETAILS PB WHERE P.LOCATIONID = IN_LOCATIONID --AND P.BILLNO = PB.BILLNO AND P.BILLINGTYPEID = 1 AND P.PATIENTSERVICE = 2 AND TRUNC(P.BILLDATE) BETWEEN TRUNC(IN_MONTHDATE) AND TRUNC(IN_FROMDATE) UNION ALL SELECT 'OP CASH' PARTICULARS, 0, 0, SUM(P.TOTALSERVICEAMOUNT) TOTAL_CASH_AMOUNT_YEAR FROM GTT_PATIENTBILL P--BILLING.PATIENTBILL P, BILLING.PATIENTBILLDETAILS PB WHERE P.LOCATIONID = IN_LOCATIONID --AND P.BILLNO = PB.BILLNO AND P.BILLINGTYPEID = 1 AND P.PATIENTSERVICE = 2 AND TRUNC(P.BILLDATE) BETWEEN TRUNC(IN_YEARDATE) AND TRUNC(IN_FROMDATE) UNION ALL SELECT 'IP CASH' PARTICULARS, SUM(P.TOTALSERVICEAMOUNT) TOTAL_CASH_AMOUNT_DAY, 0 TOTAL_CASH_AMOUNT_MONTH, 0 TOTAL_CASH_AMOUNT_YEAR FROM GTT_PATIENTBILL P--BILLING.PATIENTBILL P, BILLING.PATIENTBILLDETAILS PB WHERE P.LOCATIONID = IN_LOCATIONID --AND P.BILLNO = PB.BILLNO AND P.BILLINGTYPEID = 1 AND P.PATIENTSERVICE = 3 AND TRUNC(P.BILLDATE) = TRUNC(IN_FROMDATE) UNION ALL SELECT 'IP CASH' PARTICULARS, 0, SUM(P.TOTALSERVICEAMOUNT) TOTAL_CASH_AMOUNT_MONTH, 0 FROM GTT_PATIENTBILL P--BILLING.PATIENTBILL P, BILLING.PATIENTBILLDETAILS PB WHERE P.LOCATIONID = IN_LOCATIONID --AND P.BILLNO = PB.BILLNO AND P.BILLINGTYPEID = 1 AND P.PATIENTSERVICE = 3 AND TRUNC(P.BILLDATE) BETWEEN TRUNC(IN_MONTHDATE) AND TRUNC(IN_FROMDATE) UNION ALL SELECT 'IP CASH' PARTICULARS, 0, 0, SUM(P.TOTALSERVICEAMOUNT) TOTAL_CASH_AMOUNT_YEAR FROM GTT_PATIENTBILL P--BILLING.PATIENTBILL P, BILLING.PATIENTBILLDETAILS PB WHERE P.LOCATIONID = IN_LOCATIONID --AND P.BILLNO = PB.BILLNO AND P.BILLINGTYPEID = 1 AND P.PATIENTSERVICE = 3 AND TRUNC(P.BILLDATE) BETWEEN TRUNC(IN_YEARDATE) AND TRUNC(IN_FROMDATE)) T1 GROUP BY PARTICULARS
You can do this in the same query. As long as the underlying table is the same thing that you don't have to have multiple queries to the same table. You just improvise on your selection fields. Use a CASE statement instead of DECIDING that I used and include the other INDICATIONS which I didn't understand.
-
Hello
We have two tables test_a and test_b and would like to get the result of this query:
COL1 VAL_A VAL_B
------------------------------ ------------------------------ -------------
code_1 aa_1 aa_1
code_1 aa_2 aa_2
code_1 aa_3
code_2 bb_1
code_2 bb_2
Could someone please help on this, thanks a lot!
create table test_a)
col1 varchar2 (30),
col2 varchar2 (30));
insert into values test_a ('code_1', 'aa_1');
insert into values test_a ('code_1', 'aa_2');
insert into values test_a ('code_1', 'aa_3');
insert into test_a values ('code_2', 'bb_1');
commit;
create table test_b)
col1 varchar2 (30),
col2 varchar2 (30));
insert into test_b values ('code_1', 'aa_1');
insert into test_b values ('code_1', 'aa_2');
insert into test_b values ('code_2', 'bb_2');
commit;
Select * from test_a;
COL1 COL2
------------------------------ ------------------------------
code_1 aa_1
code_1 aa_2
code_1 aa_3
code_2 bb_1
Select * from test_b;
COL1 COL2
------------------------------ ------------------------------
code_1 aa_1
code_1 aa_2
code_2 bb_2
Published by: user489948 on January 5, 2010 10:13
Published by: user489948 on January 5, 2010 10:15
Maybe you are looking for
-
My music contains songs, I did not add
Add new songs I did not reappear in my list of my music. They are all of the same record label that makes me think I'm done somehow on some sort of list of automated subscriptions. This happened to someone else? I want to turn it off. Thanks in advan
-
How do I downgrade to iOS to iOS 9.2.1 7 or 8
I would like my mini iPad (wifi) to iOS Downgrader 7 or 8 as iOS 9 have the features or set out as I'd like. Can you help me my downgrade?
-
Sony Auto Launcher popup - how to stop
I get this pop-up and it really disrupts my workflow. I tried to click always allow and it is sill above and it still is constantly repeated. I have found no application under the name of "SonyAutoLauncher" and I would like to get rid of him. Any sug
-
Hi all I use my Vision assistant (2015, 64 bit, build 20150612021331) for the batch of treatment on several images in the browser. Ok. But for that matter, as he returned after the batch script to change by doubling (copy - paste) a bunch of "VIbox".
-
extra folder created when uploading photos
with XP I could download pictures from my camera to a specific file and have the images named with my naming convention. With Windows 7, I always get a new folder created in my folder of destination for whenever I have download the images. I now have