Select xml content
Hi,
I want to select from xmltype column, but I need the content as xml structure
i.e i wrote
(select dbms_xmlgen.getxml('select xml_content from xml_test') xml from dual)
where xml_content includes xml type and I need the output as following
<a>
<b>1</b>
<c>2</ic>
<d>3</d>
<e>2</d>
<f>13</f>
<g>332</g>
</a>
I executed the query in sql command it is working fine but in the reion inside the application it is giving the following
1 2 3 4 13 332
i.e just the values.
I need whole structure.
any idea??
Regards.
Mohd.
Edited by: Ajeeb on Aug 23, 2010 1:28 PM
hi all,
any idea please ..
regards.
mohd.
Similar Messages
-
Inserting XML content into Database
Hallo
i´m new to Oracle.
i want to insert xml content into the database. for testing i installed the version 10g on a windowsxp computer.
i read the oracle xmldb developer´s guide. on page 3-4 ff. it is explained how i can insert content into the database. that´s how i did it (with isqlplus):
create table example1(key_column varchar2(10) primary key, xml_column xmltype)
-->works fine
create table example2 of xmltype
-->works fine
now i made a directory under c:\myXmlFilesForDb in WinXp
create directory xmldir as 'c:/myXmlFilesForDb in WinXp'
(also tried: create directory xmldir as 'c:\myXmlFilesForDb in WinXp')
--> in this directory is a file named: mydokument.xml
--> works fine
insert into example2 values(xmltype(bfilename('xmldir','mydokument.xml'), nls_charset_id('AL32UTF8')))
the following error message is displayed (in German):
ORA-22285: Verzeichnis oder Datei für FILEOPEN-Vorgang nicht vorhanden
ORA-06512: in "SYS.DBMS_LOB",Zeile 523
ORA-06512: in "SYS:XMLTYPE",Zeile 287
ORA-06512: in Zeile 1
whats wrong? can anybody help me please?
ohhh....
thank you very much
cu
GeorgeDirectory entries are case sensitive.
Select * From dba_directories to ensure you case is the same as you are using in your insert statement.
Are you using the same user? if not grant read on directory directoryname to username;
try to just select.
select dbms_lob.getLength(BFileName('directoryname','filename.xml'))
as length
from dual; -
Sorting xml content based on decimal numbers
hi,
I would like to proceed a sorting an xml content. So, when the sorting elements are numbers, I must add the dt:dt="number" attribute in the concerned tag.
But when this number are decimal numbers, it seems that the sorting occurs only when the decimal separator is the '.', but it does not work when the decimal separator is the ','.
So is there a solution for sorting decimal numbr with the decimal separator ',' ?
Thanks in advance
ByeTypically the best way is if you know the name of the default table that contains your document. You do the update on the default table as follows
update yourTable t
set object_value = updateXML(...)
where ref(t) = (
select extractValue(res,'/Resource/XMLRef')
from resource_view
where equals_path(res,'/some/path/mydocument.xml') = 1
) -
XML Content is loading in URL - why?
The content of XML file i am calling is loading into the URL
when i getURL and i wish to trim it or simply get rid of the
content and keep the urlBhaskar,
Go to Content Admin -> Portal Content Transition -> Transition Worklist coordination -> Select the content what you are displaying in the Content Area i.e Iviews or pages.
Here in the portal content create WorkList by righr clciking on some folder.
here add the portal content to this worklist.
After that generate the Transition Data. A button for this will be in the top left.
Then relaese for transition.
Here then Search worklist and define the source and target languages.
Then load the worklist for transiton .
Then transulate the worklist
Then mark the workklist as transulated
Then the final step is Publish Transition.
Thanks
Raju Bonagiri -
Extracting xml content in a XMLTYPE VIEW
Experts:
I need to create an xmltype view based on the following xml content.
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<EMPLOYEES CREATED="2013-02-06T12:33:00" xsi:noNamespaceSchemaLocation="http://supporthtml.oracle.com/TEST_SCHEMA.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<EMPLOYEE_TRANS MODE="A" emp_id="1">
<emp_nm>SCOTT</emp_nm>
<emp_dept>FN</emp_dept>
<mgr>DON</mgr>
<sal>4000</sal>
<updt_ts>2013-02-06T12:28:00</updt_ts>
</EMPLOYEE_TRANS>
<EMPLOYEE_TRANS MODE="A" emp_id="2">
<emp_nm>KEVIN</emp_nm>
<emp_dept>HR</emp_dept>
<mgr>MIKE</mgr>
<sal>3000</sal>
<updt_ts>2013-02-06T12:29:00</updt_ts>
</EMPLOYEE_TRANS>
</EMPLOYEES>I want to run a select statement againt this view which can give me column data in this format.
This xml is already stored in an Oracle XMLTYPE Object Relation table which conforms to a registered xsd schema document.
select CREATED, MODE, EMP_ID, emp_nm, emp_dept, mgr, sal, updt_ts from employees_view.
Result:
2013-02-06T12:33:00 A 1 SCOTT FN DON 4000 2013-02-06T12:28:00
2013-02-06T12:33:00 A 2 KEVIN HR MIKE 3000 2013-02-06T12:29:00How can I achieve this? I tried by getting various errors. I would appreciate if someone can send me a sample
11.2.0.3
Linux
XMLDBThanks
Kevin
Edited by: Kevin_K on Feb 6, 2013 9:54 AM
Edited by: Kevin_K on Feb 6, 2013 9:55 AMI guess the above makes a regular relational view? correct?Yes.
How can I extract the of CREATED attribute from the top most employees element and attributes "MODE" and "emp_id" from EMPLOYEE_TRANS element ? You have to use a two-level approach :
SQL> select x1.created, x2.*
2 from EMPLOYEES_OR_TABLE t
3 , xmltable('/EMPLOYEES'
4 passing t.object_value
5 columns created timestamp path '@CREATED'
6 , emps xmltype path 'EMPLOYEE_TRANS'
7 ) x1
8 , xmltable('/EMPLOYEE_TRANS'
9 passing x1.emps
10 columns emp_mode varchar2(1) path '@MODE'
11 , emp_id number path '@emp_id'
12 , emp_nm varchar2(30) path 'emp_nm'
13 , updt_ts timestamp path 'updt_ts'
14 ) x2 ;
CREATED EMP_MODE EMP_ID EMP_NM UPDT_TS
06/02/13 12:33:00,000000 A 1 SCOTT 06/02/13 12:28:00,000000
06/02/13 12:33:00,000000 A 2 KEVIN 06/02/13 12:29:00,000000
The first XMLTable x1 extracts top-level information, then passes the collection of EMPLOYEE_TRANS elements to a second XMLTable that breaks each item in separate rows and columns.
It's also possible to use a single XMLTable, but with a little more complex XQuery expression. -
Using Views to access XML Content
I was wondering if anyone can help me in these questions.
I created a view to access XML Content in the database for reports. My first question is I have 18 properties in the xml document but when I created the view I only retrieve one property information. What dO I need to change in my XPath query to get all the properties see script below
CREATE OR REPLACE VIEW AHA_PMCO_BUILDINGS_VIEW
(BUILDINGID,NUMBEROFFLOORS, CONSTRUCTIONDATE,NAME, BUILDINGTYPE, DEMODISPODATE,MODSTARTDATE,MODENDDATE, ISANNEX) as
select extractValue(value(p),'/Building/@Id'),
extractValue(value(p),'/Building/@NumberOfFloors'),
extractValue(value(p),'/Building/@ConstructionDate'),
extractValue(value(p),'/Building/@Name'),
extractValue(value(p),'/Building/@BuildingType'),
extractValue(value(p),'/Building/@DemolitionDispositionDate'),
extractValue(value(p),'/Building/@ModernizationStartDate'),
extractValue(value(p),'/Building/@ModernizationEndDate'),
extractValue(value(p),'/Building/@IsAnnex')
from "Pmco438_TAB" X, TABLE(xmlsequence (extract(value(X), '/Pmco/Properties[1]/Property[1]/Buildings/Building')) ) p;
How do I change my script to retrieve multiple properties instead of just one property
Thanks
DiborHi Paul
I have access to all the documents (JavaScript via Mozilla, Adobe JavaScript API, XFA API etc etc) but none are specific enough to cater for this issue. I will work this out before too long but it would be very useful if someone who had done this already could shortcut my journey!
Thanks
Roxy -
Member selection xml is malformed, can't initialise dialog
Hi,
when I try to use a valid web form in smartview it works, until I try to change the default form variable to refresh data at which point I get; - Member selection xml is malformed, can't initialise dialog
11.1.2.1.00 (Build 271) is my version.
Anyone know a fix?
thanks,
Robert.Hi again.
On further analysis this only manifests in our Entity dimension, the other dimensions' form variables function as they should.
Is your question about substitution variables aimed at the underlying data content of the dimension, rather than the naming of the form variable, are you indicating that there are certain restrictive characters that if they appear in the data can cause this problem??
If so is " all I need to look for, or are there any other characters (& : )? that can cause problems??
thanks again,
Robert. -
Selecting xml-messages from ORABPEL-schema via SQL
Hi,
i want to select xml documents via SQL from the ORABPEL schema.
Can anybody help, how to do this?
There is the table xml_document, which has the columns:
DOCKEY
DOMAIN_REF
BIN_CSIZE
BIN_USIZE
BIN
MODIFY_DATE
BIN_FORMAT
Bin is of type blob...."Installation Monkey", did you ever find a solution or sample code to access and decipher the Audit_trail.LOG contents through a query or using SQL lob calls?
I have looked all over, tried decoding the hex code (into a second layer of gibberish), and found nothing other than pointers to the API bpels.
Thank you for any information. -
Shred XML and select XML column as multiple columns
Hi,
Kindly assist me.
I need to split XML Column(XSD defined) and select as different columns.
CREATE
XML
SCHEMA
COLLECTION [dbo].[Groupers]
AS
N'<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="grouper">
<xsd:complexType>
<xsd:complexContent>
<xsd:restriction base="xsd:anyType">
<xsd:sequence />
<xsd:attribute name="payorid" type="xsd:anySimpleType" use="required" />
<xsd:attribute name="version" type="xsd:anySimpleType" />
<xsd:attribute name="type" type="xsd:anySimpleType" />
<xsd:attribute name="payortag" type="xsd:anySimpleType" use="required" />
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="groupers">
<xsd:complexType>
<xsd:complexContent>
<xsd:restriction base="xsd:anyType">
<xsd:sequence>
<xsd:element ref="grouper" minOccurs="0" maxOccurs="4" />
</xsd:sequence>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
</xsd:schema>'
GO
CREATE
TABLE TestTable1
Groupers
XML
(CONTENT [dbo].[Groupers])
NULL,
Description
varchar(255),
insert
into TestTable1
values('<groupers><grouper
payorid="1" version="30" type="A" payortag="36" /></groupers>','TestDescriptio1')
/* This is NOT working , Please help here*/
SELECT
Groupers
.value('(/groupers/grouper/@version)[1]',
'varchar(50)')
FROM TestTable1
/* This way it is working */
Declare
@GroupersXML XML
SELECT
@GroupersXML
= Groupers
FROM TestTable1
select @GroupersXML.value('(/groupers/grouper/@version)[1]',
'varchar(50)')Hi Singh,
Thanks for your solution, it is working good.
But i stuck with different problem now, say my XML has three elements, then it is showing me records thrice, since we've done cross apply.
Now what i need is to show only 1 record, and display the three elements from the XML as three columns.
Kindly assist me.
I assume you have ran my earlier scripts, please execute this
Update
testtable1 set groupers='<groupers>
<grouper payorid="1" version="30" type="A" payortag="36" />
<grouper payorid="3" version="20" type="C" payortag="9" />
<grouper payorid="4" version="10" type="D" payortag="4" />
</groupers>'
where
description='TestDescriptio1'
For that use the same suggestion and apply PIVOT over it
ie like
;With CTE
AS
SELECT tbl.Description,
t.c.value('string(@version)', 'varchar(50)') as Version,
t.c.value('@payorid', 'varchar(50)') as payorid
FROM TestTable1 tbl
CROSS APPLY Groupers.nodes('/groupers/grouper') as t(c)
SELECT *
FROM (SELECT ROW_NUMBER() OVER (PARTITION BY Description ORDER BY payorid) AS Seq,Description,Version
FROM CTE)c
PIVOT(MAX(Version) FOR Seq IN ([1],[2],[3],[4],[5]))p
To make it dynamic see
http://beyondrelational.com/modules/2/blogs/70/posts/10840/dynamic-pivot-in-sql-server-2005.aspx
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Hi,
I have loaded XML in the local database table remotely in the URL (http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml)
CREATE TABLE url_tab
URL_NAME VARCHAR2(100),
URL SYS.URIType
INSERT INTO url_tab VALUES
('This is a test URL',
sys.UriFactory.getUri('http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml')
CREATE TABLE xml_data_tab ( xml_data xmltype );
insert into xml_data_tab select sys.xmltype.createXML(u.url.getClob()) from url_tab u;
I am able to read the BANK NAME use the below query and the output of the query is " European Central Bank "
select * from
XMLTable(XMLNamespaces('http://www.gesmes.org/xml/2002-08-01' as "gesmes"),
'/gesmes:Envelope'
PASSING (select * from xml_data_tab)
columns
Bank_name varchar2(100) path '/gesmes:Envelope/gesmes:Sender/gesmes:name'
) xt;
Can you please help me out with the SQL or PL/SQL code to read the DATE, Currency Code and the Conversion Rate available in the XML.
Thank you.I don't know what kind of tool you are using. It looks it can not handle the opague datatype XMLType. Make an attempt via the following...
select x1.cubexml.getCLOBVal() as result
from XMLTable(XMLNamespaces('http://www.gesmes.org/xml/2002-08-01' as "gesmes"),
'/gesmes:Envelope'
PASSING (select * from xml_data_tab)
columns
cube_date varchar2(4000) path 'Cube/Cube/@time',
cubexml xmltype 'Cube/Cube'
) x1 ;
or
select XMLSERIALIZE( CONTENT x1.cubexml as CLOB indent size=1) as result
from XMLTable(XMLNamespaces('http://www.gesmes.org/xml/2002-08-01' as "gesmes"),
'/gesmes:Envelope'
PASSING (select * from xml_data_tab)
columns
cube_date varchar2(4000) path 'Cube/Cube/@time',
cubexml xmltype 'Cube/Cube'
) x1 ; -
Adding version and stylesheet href to an XML content
Hi there guys!
I am new working with XML in Oracle 9i, so I would appreciate your tips. My problem is that I need to store a XML document into a variable, which must include the "version" and "stylesheet href" lines on its body.
For example, if I use the following sample query:
SELECT XMLCONCAT(
XMLELEMENT("TraspasoSaldo",
SELECT
XMLELEMENT("Encabezado",
XMLELEMENT("Valor1", 'Valor1'),
XMLELEMENT("Valor2", 'Valor2')
) As "Encabezado"
FROM Dual
SELECT
XMLELEMENT("Detalle",
XMLELEMENT("Valor1", 'Valor1'),
XMLELEMENT("Valor2", 'Valor2')
) As "Detalle"
FROM Dual
).getclobval()
INTO
XMLCONTENTDATA --> Declared as: XMLCONTENTDATA CLOB := EMPTY_CLOB;
FROM Dual
;Above query saves the following XML content in the XMLCONTENTDATA variable, which is correct:
<TraspasoSaldo>
<Encabezado>
<Valor1>Valor1</Valor1>
<Valor2>Valor2</Valor2>
</Encabezado>
<Detalle>
<Valor1>Valor1</Valor1>
<Valor2>Valor2</Valor2>
</Detalle>
</TraspasoSaldo>But, I need to add next 2 lines to this XML document:
<?xml version = ''1.0''?>
<?xml-stylesheet href="../xsl_path/My_StyleSheet.xsl" type="text/xsl"?>I have tried many things without success, because the XML content always looses its properties and structure. For example, trying to avoid this problem, I have tried to concatenate these 2 lines using the following trick:
x := '<?xml version = ''1.0''?>' || CHR(13) || CHR(10);
len := length(x);
dbms_lob.writeappend(HEADCLOB, len, x);
x := '<?xml-stylesheet href="../xsl_path/My_StyleSheet.xsl" type="text/xsl"?>' || CHR(13) || CHR(10);
len := length(x);
dbms_lob.writeappend(HEADCLOB, len, x);
dbms_lob.append(HEADCLOB, XMLCONTENTDATA);
XMLCONTENTDATA := HEADCLOB;But at the end I just received a text file, instead of a XML document:
<?xmlversion=''1.0''?>
<?xml-stylesheethref="../xsl_path/My_StyleSheet.xsl"type="text/xsl"?>
<TraspasoSaldo><Encabezado><Valor1>Valor1</Valor1><Valor2>Valor2</Valor2></Encabezado><Detalle><Valor1>Valor1</Valor1><Valor2>Valor2</Valor2></Detalle></TraspasoSaldo>As you can see above, the XML structure is lost, so the content of the XMLCONTENTDATA variable is not an XML anymore.
Any tips or ideas?
Thanks very much in advance for any help on this issue!!
PS: It is required to save this XML content into a variable in order to pass its value to a program.
Best regards,
FranciscoAs you can see above, the XML structure is lost, so the content of the XMLCONTENTDATA variable is not an XML anymore.The structure (i.e. format) is absolutely of no importance for a xml file.
What you have shown when concatenating the two parts still make a valid xml !!
Nevertheless you can also always do sth like
SQL> with t as (
select dbms_xmlgen.getxmltype('select * from dept where rownum =1') xml from dual
-- generate some sample xml
select xmltype('<?xml version = ''1.0''?>
<?xml-stylesheet href="../xsl_path/My_StyleSheet.xsl" type="text/xsl"?>' || xml) xml from t
XML
<?xml version="1.0"?>
<?xml-stylesheet href="../xsl_path/My_StyleSheet.xsl" type="text/xsl"?>
<ROWSET>
<ROW>
<DEPTNO>10</DEPTNO>
<DNAME>ACCOUNTING</DNAME>
<LOC>NEW YORK</LOC>
</ROW>
</ROWSET>
1 row selected. -
How to delete xml content without deleting the content of the object?
Hey, with the following code I am marking up a page item and deleting it's xml content:
text_value = text_area.xmlElements.add('text', current)
text_value.contents = '';
current is the current app.selection. The code works, with one downside: It also deletes the content of my text frame in my document. I only want to delete the xml content. Is this somehow possible?
Thanks in advance!!
Regards
FredDear Fred,
Please use the below Code, this will helps you to achieve your target.
//============================== Script Starts ============================================//
var doc = app.documents[0];
//========================================================================//
/* Use Glue Code */
//==================================================================//
__RemoveXMLElments(doc);
function __RemoveXMLElments(doc)
var elementXpath = "//text";
var myRuleSet = new Array (new __RemoveXMLElments_XPath(elementXpath));
with(doc){
var elements = xmlElements;
__processRuleSet(elements.item(0), myRuleSet);
function __RemoveXMLElments_XPath (Txts)
this.name = "RemoveTexts";
this.xpath = Txts;
this.apply = function(myElement, myRuleProcessor){
with(myElement){
try{
var myCnts = myElement.texts.everyItem();
myCnts.remove();
}catch(e)
//============================== Script End============================================//
Thanks & Regards
T.R.Harihara SudhaN -
Team , Thanks for looking into this ..
As a last resort on optimizing my stored procedure ( Below ) i wanted to create a Selective XML index ( Normal XML indexes doesn't seem to be improving performance as needed ) but i keep getting this error within my stored proc . Selective XML
Index feature is not supported for the current database version.. How ever
EXECUTE sys.sp_db_selective_xml_index; return 1 , stating Selective XML Indexes are enabled on my current database .
Is there ANY alternative way i can optimize below stored proc ?
Thanks in advance for your response(s) !
/****** Object: StoredProcedure [dbo].[MN_Process_DDLSchema_Changes] Script Date: 3/11/2015 3:10:42 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- EXEC [dbo].[MN_Process_DDLSchema_Changes]
ALTER PROCEDURE [dbo].[MN_Process_DDLSchema_Changes]
AS
BEGIN
SET NOCOUNT ON --Does'nt have impact ( May be this wont on SQL Server Extended events session's being created on Server(s) , DB's )
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
select getdate() as getdate_0
DECLARE @XML XML , @Prev_Insertion_time DATETIME
-- Staging Previous Load time for filtering purpose ( Performance optimize while on insert )
SET @Prev_Insertion_time = (SELECT MAX(EE_Time_Stamp) FROM dbo.MN_DDLSchema_Changes_log ) -- Perf Optimize
-- PRINT '1'
CREATE TABLE #Temp
EventName VARCHAR(100),
Time_Stamp_EE DATETIME,
ObjectName VARCHAR(100),
ObjectType VARCHAR(100),
DbName VARCHAR(100),
ddl_Phase VARCHAR(50),
ClientAppName VARCHAR(2000),
ClientHostName VARCHAR(100),
server_instance_name VARCHAR(100),
ServerPrincipalName VARCHAR(100),
nt_username varchar(100),
SqlText NVARCHAR(MAX)
CREATE TABLE #XML_Hold
ID INT NOT NULL IDENTITY(1,1) PRIMARY KEY , -- PK necessity for Indexing on XML Col
BufferXml XML
select getdate() as getdate_01
INSERT INTO #XML_Hold (BufferXml)
SELECT
CAST(target_data AS XML) AS BufferXml -- Buffer Storage from SQL Extended Event(s) , Looks like there is a limitation with xml size ?? Need to re-search .
FROM sys.dm_xe_session_targets xet
INNER JOIN sys.dm_xe_sessions xes
ON xes.address = xet.event_session_address
WHERE xes.name = 'Capture DDL Schema Changes' --Ryelugu : 03/05/2015 Session being created withing SQL Server Extended Events
--RETURN
--SELECT * FROM #XML_Hold
select getdate() as getdate_1
-- 03/10/2015 RYelugu : Error while creating XML Index : Selective XML Index feature is not supported for the current database version
CREATE SELECTIVE XML INDEX SXI_TimeStamp ON #XML_Hold(BufferXml)
FOR
PathTimeStamp ='/RingBufferTarget/event/timestamp' AS XQUERY 'node()'
--RETURN
--CREATE PRIMARY XML INDEX [IX_XML_Hold] ON #XML_Hold(BufferXml) -- Ryelugu 03/09/2015 - Primary Index
--SELECT GETDATE() AS GETDATE_2
-- RYelugu 03/10/2015 -Creating secondary XML index doesnt make significant improvement at Query Optimizer , Instead creation takes more time , Only primary should be good here
--CREATE XML INDEX [IX_XML_Hold_values] ON #XML_Hold(BufferXml) -- Ryelugu 03/09/2015 - Primary Index , --There should exists a Primary for a secondary creation
--USING XML INDEX [IX_XML_Hold]
---- FOR VALUE
-- --FOR PROPERTY
-- FOR PATH
--SELECT GETDATE() AS GETDATE_3
--PRINT '2'
-- RETURN
SELECT GETDATE() GETDATE_3
INSERT INTO #Temp
EventName ,
Time_Stamp_EE ,
ObjectName ,
ObjectType,
DbName ,
ddl_Phase ,
ClientAppName ,
ClientHostName,
server_instance_name,
nt_username,
ServerPrincipalName ,
SqlText
SELECT
p.q.value('@name[1]','varchar(100)') AS eventname,
p.q.value('@timestamp[1]','datetime') AS timestampvalue,
p.q.value('(./data[@name="object_name"]/value)[1]','varchar(100)') AS objectname,
p.q.value('(./data[@name="object_type"]/text)[1]','varchar(100)') AS ObjectType,
p.q.value('(./action[@name="database_name"]/value)[1]','varchar(100)') AS databasename,
p.q.value('(./data[@name="ddl_phase"]/text)[1]','varchar(100)') AS ddl_phase,
p.q.value('(./action[@name="client_app_name"]/value)[1]','varchar(100)') AS clientappname,
p.q.value('(./action[@name="client_hostname"]/value)[1]','varchar(100)') AS clienthostname,
p.q.value('(./action[@name="server_instance_name"]/value)[1]','varchar(100)') AS server_instance_name,
p.q.value('(./action[@name="nt_username"]/value)[1]','varchar(100)') AS nt_username,
p.q.value('(./action[@name="server_principal_name"]/value)[1]','varchar(100)') AS serverprincipalname,
p.q.value('(./action[@name="sql_text"]/value)[1]','Nvarchar(max)') AS sqltext
FROM #XML_Hold
CROSS APPLY BufferXml.nodes('/RingBufferTarget/event')p(q)
WHERE -- Ryelugu 03/05/2015 - Perf Optimize - Filtering the Buffered XML so as not to lookup at previoulsy loaded records into stage table
p.q.value('@timestamp[1]','datetime') >= ISNULL(@Prev_Insertion_time ,p.q.value('@timestamp[1]','datetime'))
AND p.q.value('(./data[@name="ddl_phase"]/text)[1]','varchar(100)') ='Commit' --Ryelugu 03/06/2015 - Every Event records a begin version and a commit version into Buffer ( XML ) we need the committed version
AND p.q.value('(./data[@name="object_type"]/text)[1]','varchar(100)') <> 'STATISTICS' --Ryelugu 03/06/2015 - May be SQL Server Internally Creates Statistics for #Temp tables , we do not want Creation of STATISTICS Statement to be logged
AND p.q.value('(./data[@name="object_name"]/value)[1]','varchar(100)') NOT LIKE '%#%' -- Any stored proc which creates a temp table within it Extended Event does capture this creation statement SQL as well , we dont need it though
AND p.q.value('(./action[@name="client_app_name"]/value)[1]','varchar(100)') <> 'Replication Monitor' --Ryelugu : 03/09/2015 We do not want any records being caprutred by Replication Monitor ??
SELECT GETDATE() GETDATE_4
-- SELECT * FROM #TEMP
-- SELECT COUNT(*) FROM #TEMP
-- SELECT GETDATE()
-- RETURN
-- PRINT '3'
--RETURN
INSERT INTO [dbo].[MN_DDLSchema_Changes_log]
[UserName]
,[DbName]
,[ObjectName]
,[client_app_name]
,[ClientHostName]
,[ServerName]
,[SQL_TEXT]
,[EE_Time_Stamp]
,[Event_Name]
SELECT
CASE WHEN T.nt_username IS NULL OR LEN(T.nt_username) = 0 THEN t.ServerPrincipalName
ELSE T.nt_username
END
,T.DbName
,T.objectname
,T.clientappname
,t.ClientHostName
,T.server_instance_name
,T.sqltext
,T.Time_Stamp_EE
,T.eventname
FROM
#TEMP T
/** -- RYelugu 03/06/2015 - Filters are now being applied directly while retrieving records from BUFFER or on XML
-- Ryelugu 03/15/2015 - More filters are likely to be added on further testing
WHERE ddl_Phase ='Commit'
AND ObjectType <> 'STATISTICS' --Ryelugu 03/06/2015 - May be SQL Server Internally Creates Statistics for #Temp tables , we do not want Creation of STATISTICS Statement to be logged
AND ObjectName NOT LIKE '%#%' -- Any stored proc which creates a temp table within it Extended Event does capture this creation statement SQL as well , we dont need it though
AND T.Time_Stamp_EE >= @Prev_Insertion_time --Ryelugu 03/05/2015 - Performance Optimize
AND NOT EXISTS ( SELECT 1 FROM [dbo].[MN_DDLSchema_Changes_log] MN
WHERE MN.[ServerName] = T.server_instance_name -- Ryelugu Server Name needes to be added on to to xml ( Events in session )
AND MN.[DbName] = T.DbName
AND MN.[Event_Name] = T.EventName
AND MN.[ObjectName]= T.ObjectName
AND MN.[EE_Time_Stamp] = T.Time_Stamp_EE
AND MN.[SQL_TEXT] =T.SqlText -- Ryelugu 03/05/2015 This is a comparision Metric as well , But needs to decide on
-- Peformance Factor here , Will take advise from Lance if comparision on varchar(max) is a vital idea
--SELECT GETDATE()
--PRINT '4'
--RETURN
SELECT
top 100
[EE_Time_Stamp]
,[ServerName]
,[DbName]
,[Event_Name]
,[ObjectName]
,[UserName]
,[SQL_TEXT]
,[client_app_name]
,[Created_Date]
,[ClientHostName]
FROM
[dbo].[MN_DDLSchema_Changes_log]
ORDER BY [EE_Time_Stamp] desc
-- select getdate()
-- ** DELETE EVENTS after logging into Physical table
-- NEED TO Identify if this @XML can be updated into physical system table such that previously loaded events are left untoched
-- SET @XML.modify('delete /event/class/.[@timestamp="2015-03-06T13:01:19.020Z"]')
-- SELECT @XML
SELECT GETDATE() GETDATE_5
END
GO
Rajkumar Yelugu@@Version : ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Microsoft SQL Server 2012 - 11.0.5058.0 (X64)
May 14 2014 18:34:29
Copyright (c) Microsoft Corporation
Developer Edition (64-bit) on Windows NT 6.2 <X64> (Build 9200: ) (Hypervisor)
(1 row(s) affected)
Compatibility level is set to 110 .
One of the limitation states - XML columns with a depth of more than 128 nested nodes
How do i verify this ? Thanks .
Rajkumar Yelugu -
How to change "Select a content category " text
Hi folks,
I really appreciate the support community, as I did deeper and deeper into the produce I've seen the same handful of names pop up across the board! Thanks for all your help!
I was wondering how to change the "Select a content category>>" text that displays in a traditional skin next to your content categories upon generation. Specifically this:
Is there a way to edit the text? Mine are focused on government levels and I'd like to make it easier for users.
Thanks! Happy New Year!Hi there
I believe you do it as follows:
Click File > Project Settings.
Ensure the General tab has focus.
Click the Advanced... button.
Click the LNG File tab.
Scroll the list to the [WebHelp] section.
Locate the item that reads: ContentCategoryList=Select a content category.
Click on it to select it.
Click the Edit button.
Change the text following the equals sign it to what you want it to read.
ContentCategoryList=Change this text
Press Enter to accept the change.
Click OK to dismiss the dialogs.
Generate and test!
Hope this helps... Rick -
Catch all error information while validating xml content with xsd schema
Hi experts,
I created a java mapping to validating the input xml content with xsd schema (schema validation). What I want is to catch all error message to the xml not just the first error. I used SAXParser in sapxmltoolkit.jar to do the schema validation. The below is a part of my java mapping.
XMLReader parser = XMLReaderFactory.createXMLReader("com.sap.engine.lib.xml.parser.SAXParser");
parser.setFeature( "http://xml.org/sax/features/validation" , true);
parser.setFeature( "http://apache.org/xml/features/validation/schema" , true);
parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema"); parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource",this.getClass().getClassLoader().getResourceAsStream(schema)); // schema is my schema name
parser.setErrorHandler(new ParseErrorHandler()); // ParseErrorHandler is my own ErrorHandler which extends DefaultHandler
parser.parse(new InputSource(new ByteArrayInputStream(sinput.getBytes())));
// In error handler, I comment all code so as not to throw any exception
public class ParseErrorHandler extends DefaultHandler
public void error(SAXParseException e) throws SAXException
// sSystem.out.println("Error" + e.getMessage());
// throw e;
public void fatalError(SAXParseException e)
// throw e;
// System.out.println("SAP Fatal Error" + e.getMessage());
Unfortunately the program always stopped while catching the first error. Check the below log.
com.sap.engine.lib.xml.parser.NestedSAXParserException: Fatal Error: com.sap.engine.lib.xml.parser.ParserException:
ERRORS :
cvc-simple-type : information item '/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]/:AddressInformation[1]/:CityName[1]' is not valid, because it's value does not satisfy the constraints of facet 'minLength' with value '1'.
cvc-data : information item '/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]/:AddressInformation[1]/:CityName[1]' is is not valid with respoct to the corresponding simple type definition.
cvc-element : element information item '/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]/:AddressInformation[1]/:CityName[1]' is associated with invalid data.
cvc-element : element information item '/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]/:AddressInformation[1]' is not valid with respect to it's complex type definition..
cvc-element : element information item '/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]' is not valid with respect to it's complex type definition..
cvc-element : element information item '/:ShipNotice[1]/:Header[1]/:To[1]' is not valid with respect to it's complex type definition..
cvc-element : element information item '/:ShipNotice[1]/:Header[1]' is not valid with respect to it's complex type definition..
cvc-element : element information item '/:ShipNotice[1]' is not valid with respect to it's complex type definition..
-> com.sap.engine.lib.xml.parser.ParserException:
I tried using Xerces and JAXP to do validation, the same error happened. I have no idea on this. Does xi has its own error handler logic? Is there any body can make me get out of this?
Thanks.<h6>Hi experts,
<h6>
<h6>I created a java mapping to validating the input xml content with xsd schema (schema validation). What I want is to catch all <h6>error message to the xml not just the first error. I used SAXParser in sapxmltoolkit.jar to do the schema validation. The below <h6>is a part of my java mapping.
<h6>XMLReader parser = XMLReaderFactory.createXMLReader("com.sap.engine.lib.xml.parser.SAXParser");
<h6>parser.setFeature( "http://xml.org/sax/features/validation" , true);
<h6>parser.setFeature( "http://apache.org/xml/features/validation/schema" , true);
<h6>parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema"); <h6>parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource",this.getClass().getClassLoader().getResourceAsStream(schema)); <h6>// schema is my schema name
<h6>parser.setErrorHandler(new ParseErrorHandler()); // ParseErrorHandler is my own ErrorHandler which extends Default Handler
<h6>parser.parse(new InputSource(new ByteArrayInputStream(sinput.getBytes())));
<h6>
<h6>// In error handler, I comment all code so as not to throw any exception
<h6>public class ParseErrorHandler extends DefaultHandler
<h6>{
<h6> public void error(SAXParseException e) throws SAXException
<h6> {
<h6> // sSystem.out.println("Error" + e.getMessage());
<h6> // throw e;
<h6> }
<h6>
<h6> public void fatalError(SAXParseException e)
<h6> {
<h6> // throw e;
<h6> // System.out.println("SAP Fatal Error" + e.getMessage());
<h6>
<h6> }
<h6>
<h6>}
<h6>
<h6>Unfortunately the program always stopped while catching the first error. Check the below log.
<h6>
<h6>com.sap.engine.lib.xml.parser.NestedSAXParserException: Fatal Error: com.sap.engine.lib.xml.parser.ParserException:
<h6>ERRORS :
<h6>cvc-simple-type : information item <h6>'/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]/:AddressInformation[1]/:CityName[1]' <h6>is not valid, because it's value does not satisfy the constraints of facet 'minLength' with value '1'.
<h6>cvc-data : information item <h6>'/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]/:AddressInformation[1]/:CityName[1]' <h6>is is not valid with respoct to the corresponding simple type definition.
<h6>cvc-element : element information item <h6>'/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]/:AddressInformation[1]/:CityName[1]' <h6>is associated with invalid data.
<h6>cvc-element : element information item <h6>'/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]/:AddressInformation[1]' <h6>is not valid with respect to it's complex type definition..
<h6>cvc-element : element information item <h6>'/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]' <h6>is not valid with respect to it's complex type definition..
<h6>cvc-element : element information item <h6>'/:ShipNotice[1]/:Header[1]/:To[1]' <h6>is not valid with respect to it's complex type definition..
<h6>cvc-element : element information item <h6>'/:ShipNotice[1]/:Header[1]' <h6>is not valid with respect to it's complex type definition..
<h6>cvc-element : element information item '/:ShipNotice[1]' is not valid with <h6>respect to it's complex type definition..
<h6> -> com.sap.engine.lib.xml.parser.ParserException:
<h6>
<h6>
<h6>I tried using Xerces and JAXP to do validation, the same error happened. I have no idea on this. Does xi has its own error <h6>handler logic? Is there any body can make me get out of this?
<h6>Thanks.
Maybe you are looking for
-
Auto Update of Server.xml file
Hi i'm running JDev 9i (9.0.2) with oc4j server (also 9.0.2). I have one project containg Stateless Session bean (WizDecodeCodes) I have also another project that calls this Bean. (From Servlet) This works fine when you manually update the Parent att
-
I purchased a factory unlock I phone 4s and to use it on idea cellular network..can you help in settings of 3G please?
-
Query in ParForEach block in ccbpm
Hi, I've a query in ParForEach block in ccbpm. Please confirm how many maximum parallel instances can be created in a ParForEach Block in ccbpm.
-
After 2 years want to change depreciation key for a asset
Hi, For a particular asset we want to change depreciation key for this asset already we have posted depreciation for 2 years. After 2 years user realizes they are using wrong depreciation key now they want to change depreciation key for a particular
-
Anyone know where I can get a red corded telephone...
I need a red corded (not cordless or anything else that needs mains/batteries) phone for an installation I'm doing. Does anyone know somewhere that sells these? Perferably wall mountable. Neither the BT shop, ebay or Amazon are able to supply one! So