XML to DDL
HI
I'm using DBMS_METADATA.GET_SXML to retreive the dll in xml. Its in XML becuase I need a way to process each table's column, constraints etc, inidividually and xml nodes helps do this. Once processed the node(s) need to be transformed back into ddl format. Tthere can be many variations with regards to the data content witin the nodes e.g. in the xml below "COUNTRY_ID" has a CONSTRAINT NOT NULL and "COUNTRY_NAME" with no CONSTRAINTS?, this indicates xslt has to be aware of these factors. Perhaps someone has a more efficient approach, any suggestions and tips will be helpful. Thanks
<TABLE xmlns="http://xmlns.oracle.com/ku" version="1.0">
<SCHEMA>HR</SCHEMA>
<NAME>COUNTRIES</NAME>
<RELATIONAL_TABLE>
<COL_LIST>
<COL_LIST_ITEM>
<NAME>COUNTRY_ID</NAME>
<DATATYPE>CHAR</DATATYPE>
<LENGTH>2</LENGTH>
<NOT_NULL>
<NAME>COUNTRY_ID_NN</NAME>
</NOT_NULL>
</COL_LIST_ITEM>
<COL_LIST_ITEM>
<NAME>COUNTRY_NAME</NAME>
<DATATYPE>VARCHAR2</DATATYPE>
<LENGTH>40</LENGTH>
</COL_LIST_ITEM>
<PRIMARY_KEY_CONSTRAINT_LIST>
<PRIMARY_KEY_CONSTRAINT_LIST_ITEM>
<NAME>COUNTRY_C_ID_PK</NAME>
<COL_LIST>
<COL_LIST_ITEM>
<NAME>COUNTRY_ID</NAME>
</COL_LIST_ITEM>
</COL_LIST>
</PRIMARY_KEY_CONSTRAINT_LIST_ITEM>
</PRIMARY_KEY_CONSTRAINT_LIST>
<FOREIGN_KEY_CONSTRAINT_LIST>
<FOREIGN_KEY_CONSTRAINT_LIST_ITEM>
<NAME>COUNTR_REG_FK</NAME>
<COL_LIST>
<COL_LIST_ITEM>
<NAME>REGION_ID</NAME>
</COL_LIST_ITEM>
</COL_LIST>
<REFERENCES>
<SCHEMA>HR</SCHEMA>
<NAME>REGIONS</NAME>
<COL_LIST>
<COL_LIST_ITEM>
<NAME>REGION_ID</NAME>
</COL_LIST_ITEM>
</COL_LIST>
</REFERENCES>
</FOREIGN_KEY_CONSTRAINT_LIST_ITEM>
</FOREIGN_KEY_CONSTRAINT_LIST>
Hi,
Not sure what you're asking.
Do you want to convert back the XML to DDL once you've made your changes?
If so, the Metadata APIs already provide such functionality, provided the structure is still valid of course.
For example :
SQL> DECLARE
2 -- handles
3 h number;
4 th number;
5
6 source_doc XMLType := XMLType(dbms_metadata.get_sxml('TABLE', 'COUNTRIES', 'HR'));
7 target_doc XMLType;
8
9 ddl clob;
10
11 BEGIN
12
13 -- this increases the length of VARCHAR2 columns by 10 :
14 select xmlquery(
15 'declare default element namespace "http://xmlns.oracle.com/ku"; (: :)
16 copy $d := /TABLE
17 modify (
18 for $i in $d/RELATIONAL_TABLE/COL_LIST/COL_LIST_ITEM
19 where $i/DATATYPE = "VARCHAR2"
20 return replace value of node $i/LENGTH with xs:integer($i/LENGTH)+10
21 )
22 return $d'
23 passing source_doc
24 returning content
25 )
26 into target_doc
27 from dual;
28
29 h := dbms_metadata.openw('TABLE');
30 th := dbms_metadata.add_transform(h, 'SXMLDDL');
31
32 dbms_lob.createtemporary(ddl, false);
33 dbms_metadata.convert(h, target_doc, ddl);
34 dbms_metadata.close(h);
35
36 dbms_output.put_line(ddl);
37 dbms_lob.freetemporary(ddl);
38
39 END;
40 /
CREATE TABLE "HR"."COUNTRIES"
( "COUNTRY_ID" CHAR(2) CONSTRAINT "COUNTRY_ID_NN" NOT NULL ENABLE,
"COUNTRY_NAME" VARCHAR2(50),
"REGION_ID" NUMBER,
CONSTRAINT "COUNTRY_C_ID_PK" PRIMARY KEY
("COUNTRY_ID") ENABLE,
CONSTRAINT "COUNTR_REG_FK" FOREIGN KEY ("REGION_ID")
REFERENCES "HR"."REGIONS" ("REGION_ID") ENABLE
) ORGANIZATION INDEX NOCOMPRESS PCTFREE 10 INITRANS 2 NOLOGGING
STORAGE( INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE
"EXAMPLE"
PCTTHRESHOLD 50
Procédure PL/SQL terminée avec succès.
Similar Messages
-
Create XML file with oracle DDL information
Hi,
I am working on a architecture where I was asked to see find the solution for the following issue:
we are building a ODS which gets a feed from an ORACLE source. But ODS will not have any access to that table and the data will be pushed by source system. The requirement is whenever the source system change the table structure (add a column,drop a column, change data type) that should be reflected in ODS stage table by droping and recreating a table with the structure that comes everyday from the source. My question is without getting the DDL file from the source, can we get the structure in XML file along with data? so that I can use the XML file to create the stage table everyday in ODS. I dont' want to use xmltype or clob/varchar2. The oracle table should be rows and column.
I know XML SQL will be able to insert the xml to oracle table and oracle table can be extracted to XML type.
Thanks,
Partha.Hi,
If you need to create a new command, you can use SAP Developer Studio. After deploy you will see it in
System administration->system configuration->cm->user interface->Commands.
There are examples about how to create commands.
You need to create your own layout set. This one use a resource renderer, here you must setup the commands group that you created.
After that, you create a navigation iview and layout set field you setup your layout set.
Patricio. -
Designer 9i - nested DDL structure not executable for XML
To support an XML data transfer, we need to define types,collections, and tables. When we define a table that references types and collections, we do not get adequate DDL from Designer 9i that identifies all of the nested structures, and the DDL that is generated is not executable. We can manually type the DDL and specify the appropriate nesting. We have done that, executed that successfully. We have then reverse engineered this table into Designer 9i, and requested DDL from it. The resulting DDL is not executable. Has anyone run into this problem?
Designer 9i does not support these complex datatypes, hence your errors.
Regards
Sue -
Update text fields with xml data based on DDL selection of an ID number
Hi guys,
this one should be straight forward, but I cant seem to find a straight forward answer. In a nutshell:
XML file contains ID, Name, Location (so far 3 records in sample xml file)
Form contains a Dynamic Drop down list to allow selection of ID and text fields to display the associated name and location of that ID. The binding of the Drop down works fine, however I need the other fields to update to the associated name and location when different ID's are selected. I assume I'll need some sort of exit event on the drop down list to update the other fields with the Name and location of the ID selected, but I dont know enough to have a stab at it.
please, please, please help, Im starting to pull my hair out.
James.Hi James,
This would depend on the structure of your XML but assuming you have something like;
<Data>
<Item>
<Id>1</Id>
<Name>Name1</Name>
<Location>Location1</Location>
</Item>
<Item>
<Id>2</Id>
<Name>Name2</Name>
<Location>Location2</Location>
</Item>
<Item>
<Id>3</Id>
<Name>Name3</Name>
<Location>Location3</Location>
</Item>
</Data>
Then in the change event of your dropdown (your could use the exit event but then value might not have changed so would be performing unnecessary processing) add the following code.
var itemGroup = $data.Data.resolveNode("Item.(Id.value === '"+xfa.event.change+"')");
Name.rawValue = itemGroup.Name.value;
Location.rawValue = itemGroup.Location.value;
The xfa.event.change will be the value selected, the resolveNode will return the Item with the matching Id, and then it is just a matter of assigning it to your form fields.
Hope this gets you started.
Regards
Bruce -
Error while generating DDL commands using startSQLRepository for a new Repository
Hi,
I am trying to generate DDL Commands using startSQLRepository for my new repository SubashRepository so that I can use them to create new table structure.
All the repository related changes looks good. i can see my repository in ACC
When I run the command:
startSQLRepository -m SupremeATG –repository /com/supreme/SubashRepository /com/supreme/subashRepository.xml -outputSQLFile C:/ATG/ATG9.3/SupremeATG/config/com/supreme/subashRepositoryDDL.txt
I get following error:
Table 'SUBASH_MEMBER' in item-descriptor: 'member' does not exist in a table space accessible by the data source. DatabaseMetaData.getColumns returns no columns
Note:
* errors related to definition file were cleared as the same command threw relevant exception while trying to store a array property with out creating a multi table.
* Now this is the only exception i see
* Some DDL are getting generated in the output file, but those are related to inventory repository (I am not sure why this is happening as I have specifically gave the path to my definition file).
Any help in resolving this is highly appreciated.Pl post in the ATG forum
-
Generate Query in PLSQL to return Well Formed XML with Multiple records
Hi there
This is very urgent. I am trying to create a PLSQL query that should retrieve all records from oracle database table "tbl_Emp" in a well formed xml format. The format is given below
*<Employees xmlns="http://App.Schemas.Employees" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">*
*<Employee>*
*<First_Name></First_Name>*
*<Last_Name></Last_Name>*
*</Employee>*
*<Employee>*
*<First_Name></First_Name>*
*<Last_Name></Last_Name>*
*</Employee>*
*</Employees>*
To retrieve data in above format, I have been trying to create a query for long time as below
SELECT XMLElement("Employees",
XMLAttributes('http://App.Schemas.Employees' AS "xmlns",
*'http://www.w3.org/2001/XMLSchema-instance' AS "xmlns:xsi"),*
XMLElement("Employee", XMLForest(First_Name, Last_Name)))
AS "RESULT"
FROM tbl_Emp;
But it does not give me the required output. It creates <Employees> tag with each individual record which I don't need. I need <Employees> tag to be the root tag and <Employee> tag to repeat and wrap each individual record. Please help me in this as this is very urgent. Thanks.Hi,
Please remember that nothing is "urgent" here, and repeating that it is will likely produce the opposite effect.
If you need a quick answer, provide all necessary details in the first place :
- db version
- test case with sample data and DDL
That being said, this one's easy, you have to aggregate using XMLAgg :
SELECT XMLElement("Employees"
, XMLAttributes(
'http://App.Schemas.Employees' AS "xmlns"
, 'http://www.w3.org/2001/XMLSchema-instance' AS "xmlns:xsi"
, XMLAgg(
XMLElement("Employee"
, XMLForest(
e.first_name as "First_Name"
, e.last_name as "Last_Name"
) AS "RESULT"
FROM hr.employees e
; -
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 insert the data from XML to a table
Hi,
I'm using Oracle 10g Express Edition
I need help in How to insert the data from XML file into the table.
Below is the example i'm working on..
I have create ridb user with below mentioned privileges:
Account Status Locked Unlocked
Default Tablespace: USERS
Temporary Tablespace: TEMP
User Privileges :
Roles:
CONNECT
RESOURCE
Direct Grant System Privileges:
CREATE DATABASE LINK
CREATE MATERIALIZED VIEW
CREATE PROCEDURE
CREATE PUBLIC SYNONYM
CREATE ROLE
CREATE SEQUENCE
CREATE SYNONYM
CREATE TABLE
CREATE TRIGGER
CREATE TYPE
CREATE VIEW
& table is created TRIALZIPCODES below mentioned is the DDL:
CREATE TABLE TRIALZIPCODES
STATE_ABBR VARCHAR2(20) NOT NULL
, ZIP_CODE NUMBER(10, 0) NOT NULL
, ZIP_CODE_EXT VARCHAR2(20)
Below is the XML FILE: which is stored in C:\OracleProject Folder
File name: trial.xml
<?xml version="1.0" ?>
<metadata>
- <Zipcodes>
- <mappings Record="4">
<STATE_ABBREVIATION>CA</STATE_ABBREVIATION>
<ZIPCODE>94301</ZIPCODE>
</mappings>
- <mappings Record="5">
<STATE_ABBREVIATION>CO</STATE_ABBREVIATION>
<ZIPCODE>80323</ZIPCODE>
<ZIP_CODE_EXTN>9277</ZIP_CODE_EXTN>
</mappings>
</Zipcodes>
</metadata>
PL/SQL Procedure:which i'm trying to execute from SQLDeveloper
create or replace
PROCEDURE TRIAL AS
BEGIN
DECLARE
-- declare attributes
charString varchar2(80);
finalStr varchar2(4000) := null;
rowsp integer;
v_FileHandle UTL_FILE.FILE_TYPE;
l_context_handle dbms_xmlgen.ctxHandle;
insCtx DBMS_XMLStore.ctxType;
begin
-- DBMS_XMLGEN.setRowTag ( ctx IN ctxHandle, rowTag IN VARCHAR2);
-- DBMS_XMLGEN.setRowSetTag ( ctx IN ctxHandle, rowSetTag IN VARCHAR2);
-- the name of the table as specified in our DTD
DBMS_XMLGEN.SETROWSETTAG(l_context_handle,'zipcodes');
-- the name of the data set as specified in our DTD
DBMS_xmlgen.setRowTag(l_context_handle,'mappings');
-- for getting the output on the screen
dbms_output.enable(1000000);
-- open the XML document in read only mode
v_FileHandle := utl_file.fopen('c:/OracleProject','trial.xml', 'r');
loop
BEGIN
utl_file.get_line(v_FileHandle, charString);
exception
when no_data_found then
utl_file.fclose(v_FileHandle);
exit;
END;
dbms_output.put_line(charString);
if finalStr is not null then
finalStr := finalStr || charString;
else
finalStr := charString;
end if;
end loop;
-- for inserting the XML data into the table
insCtx := DBMS_XMLSTORE.NEWCONTEXT('RIDB.TRIALZIPCODES');
insCtx := DBMS_XMLSTORE.INSERTXML(insCtx, finalStr);
dbms_output.put_line('INSERT DONE '||TO_CHAR(rowsp));
DBMS_XMLStore.closeContext(insCtx);
END;
END TRIAL;
For the first time when i complied i got the errors as :
Procedure RIDB.PROCEDURE1@RIDB
Error(16,14): PLS-00201: identifier 'UTL_FILE' must be declared
Error(16,14): PL/SQL: Item ignored
Error(29,1): PLS-00320: the declaration of the type of this expression is incomplete or malformed
Error(29,1): PL/SQL: Statement ignored
Error(33,1): PL/SQL: Statement ignored
Error(33,19): PLS-00320: the declaration of the type of this expression is incomplete or malformed
Error(36,1): PL/SQL: Statement ignored
Error(36,17): PLS-00320: the declaration of the type of this expression is incomplete or malformed
So i logged in as sys & grant the permission to execute on UTL_FILE to ridb (user):
SQL Statement:
grant execute on utl_file to ridb
So, it got compiled successfully but when i execute it gives me error as:
Source does not have a runnable target.
What does this mean?
So I browse through forum & i got to know that i need to initial the UTL_FILE_DIR ="C:/OracleProject" in init.ora
So can i edit the init.ora with notepad.When i tried to do that it says permission denied
In my system it shows the init.ora file in path C:\oraclexe\app\oracle\product\10.2.0\server\config\scripts
but there is also other file initXETemp in the same path do i need to do the changes in it.
I have tried even editing the SPFILE as mentioned below:
C:\oraclexe\app\oracle\product\10.2.0\server\dbs\SPFILEEXE - I had edit this file using notepad & set the value of UTL_FILE_DIR ="C:/OracleProject". So next time when i restarted i'm unable to log on to the database.
So i had reinstall the software again.
Could you please let me know how to proceed..hi,
I have created the directory from sys database
CREATE or replace DIRECTORY XML_DIR2 AS 'C:\OracleProject';
& grant read,write access to the user
grant read,write on directory XML_DIR2 to RIDB;
& i had change the tag name in the xml file as shown below:
<?xml version = '1.0'?>
<metadata>
<Zipcodes>
<mappings Record="4">
<STABBRE>CA</STABBRE>
<ZIPCODE>94301</ZIPCODE>
</mappings>
<mappings Record="5">
<STABBRE>CO</STABBRE>
<ZIPCODE>80323</ZIPCODE>
<ZIPCODEEXT>9277</ZIPCODEEXT>
</mappings>
</Zipcodes>
</metadata>
TRIALZIPCODE table as shown below:
CREATE TABLE "RIDB"."TRIALZIPCODE"
( "STABBRE" VARCHAR2(20 BYTE),
"ZIPCODE" NUMBER(*,6) NOT NULL ENABLE,
"ZIPCODEEXT" NUMBER
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS" ;
I have tried two methods as shown below:
Procedure 1:
create or replace
PROCEDURE TRIAL_V2 AS
BEGIN
DECLARE
-- declare attributes
charString varchar2(80);
finalStr varchar2(4000) := null;
rowsp integer;
v_FileHandle UTL_FILE.FILE_TYPE;
l_context_handle dbms_xmlgen.ctxHandle;
insCtx DBMS_XMLStore.ctxType;
cnt NUMBER;
xmldoc xmltype := xmltype( bfilename('XML_DIR2','trialxml.xml'), nls_charset_id('AL32UTF8') );
--XML_DIR VARCHAR2(40) := 'C:\\OracleProject';
BEGIN
insCtx := DBMS_XMLStore.newContext('DEV.TRIALZIPCODES');
DBMS_XMLStore.setUpdateColumn(insCtx, 'STABBRE');
DBMS_XMLStore.setUpdateColumn(insCtx, 'ZIPCODE');
DBMS_XMLStore.setUpdatecolumn(insCtx, 'ZIPCODEEXT');
DBMS_XMLStore.setRowTag(insCtx, 'mappings');
cnt := DBMS_XMLStore.insertXML(insCtx, xmldoc);
DBMS_XMLStore.closeContext(insCtx);
END;
Procedure 1 was compiled with out errors but when i execute i got the error as :
Source does not have a runnable target.
Procedure 2_
CREATE OR REPLACE PROCEDURE TRIAL_V3 AS
BEGIN
DECLARE
-- declare attributes
charString varchar2(80);
finalStr varchar2(4000) := null;
rowsp integer;
v_FileHandle UTL_FILE.FILE_TYPE;
l_context_handle dbms_xmlgen.ctxHandle;
insCtx DBMS_XMLStore.ctxType;
cnt NUMBER;
xmldoc xmltype := xmltype( bfilename('XML_DIR2','trialxml.xml'), nls_charset_id('AL32UTF8') );
--XML_DIR VARCHAR2(40) := 'C:\\OracleProject';
BEGIN
INSERT INTO trialzipcode (STABBRE, ZIPCODE, ZIPCODEEXT)
SELECT extractvalue(x.column_value, 'mappings/STABBRE'),
extractvalue(x.column_value, 'mappings/ZIPCODE'),
extractvalue(x.column_value, 'mappings/ZIPCODEEXT')
FROM TABLE(
XMLSequence(
EXTRACT(
xmltype( bfilename('XML_DIR2','trialxml.xml'), nls_charset_id('AL32UTF8') ),
'metadata/Zipcodes/mappings'
) x
END;
END TRIAL_V3;
Procedure 2 was complied without errors but when i execute i got the error as:
Connecting to the database RIDB.
ORA-22288: file or LOB operation FILEOPEN failed
The system cannot find the file specified.
ORA-06512: at "SYS.DBMS_LOB", line 523
ORA-06512: at "SYS.XMLTYPE", line 287
ORA-06512: at "RIDB.TRIAL_V3", line 12
ORA-06512: at line 2
Process exited.
Disconnecting from the database RIDB.
Could you please let me know how to proceed... -
Error in creating an external table referring to a XML file
I've got an XML file and I've tried to create an external table referring to it in this way:
CREATE TABLE mytable
XML_DATA_COLUMN XMLType
ORGANIZATION EXTERNAL
TYPE ORACLE_LOADER DEFAULT DIRECTORY TEST_DIR
ACCESS PARAMETERS ( records delimited BY newline
(XML_DATA_COLUMN LOB) ) LOCATION ( 'myfile.xml' )
where TEST_DIR is the directory where myfile.xml is stored,
but I get this message:
Error at Command Line:3 Column:4
Error report:
SQL Error: ORA-30656: column type not supported on external organized table
30656.0000 - "column type not supported on external organized table"
*Cause: Attempt to create an external organized table with a column
of type LONG, LOB, BFILE, ADT, or VARRAY.
*Action: These column types are not supported, change the DDL.
I want to have in the XML_DATA_COLUMN the content of myfile.xml so as to handle it by using extract and extractvalue functions.
My oracle version is 10gR2 Express Edition
Thanks!The examples in the following thread include an insert, but you could also use the select statement alone without the insert.
http://www.orafaq.com/forum/mv/msg/172162/511897/0/#msg_511897 -
Migrate B-Tree Indexes of XML O-R Table to XMLIndex on Binary XML Table
We need slight help on how to migrate existing B-TREE Indexes from XML Obj-Rel Tables to XMLIndex on new XML Binary Tables
We use searches on Nested Collection Elements (defined unbounded in XSD)
and related DDL for XML Obj-Rel Tables is shown below:
CREATE TABLE TNMAB_AGREEMENT_XML
AGREEMENT_XML xmltype,
CREATE_BY VARCHAR2(15) NULL ,
CREATE_DT_GMT TIMESTAMP NULL ,
CREATE_CLIENT_ID VARCHAR2(65) NULL ,
UPDATE_BY VARCHAR2(15) NULL ,
UPDATE_DT_GMT TIMESTAMP NULL ,
UPDATE_CLIENT_ID VARCHAR2(65) NULL ,
PIC_VERSION_NUM NUMBER(20) NULL
XMLTYPE COLUMN AGREEMENT_XML XMLSCHEMA "AB_Agreement_V1_XMLDB.xsd" ELEMENT "Agreement"
VARRAY AGREEMENT_XML.XMLDATA."SHIPPING_PARTY_GROUPS"
STORE AS TABLE SHIPPING_PARTY_GROUPS_NT
(PRIMARY KEY (NESTED_TABLE_ID, ARRAY_INDEX) ENABLE)
VARRAY SHIPPING_PARTIES
STORE AS TABLE SHIPPING_PARTIES_NT
(PRIMARY KEY (NESTED_TABLE_ID, ARRAY_INDEX) ENABLE)
VARRAY AGREEMENT_XML.XMLDATA."SALES_OFFICE_CODES"."STRING_WRAPPERS"
STORE AS TABLE SALES_OFFICE_CODES_NT
(PRIMARY KEY (NESTED_TABLE_ID, ARRAY_INDEX) ENABLE)
TABLESPACE TNMAB_XMLDB_ME_DATA;
Table has PK and Unique Index which for the Binary XML Table, it will be setup on Virtual Columns (to enforce
Unique Constraints)
We have 6 more Normal Indexes on this Table, some created on Nested Elements as shown below:
-- 4 Normal B-TREE Indexes on Leaf level Elements
create index TNMAB_AGREEMENT_XML_IDX1 on TNMAB_AGREEMENT_XML (AGREEMENT_XML.XMLDATA."AGREEMENT_VERSION")
tablespace TNMAB_XMLDB_ME_INDX;
create index TNMAB_AGREEMENT_XML_IDX2 on TNMAB_AGREEMENT_XML (AGREEMENT_XML.XMLDATA."LAST_UPDATED_BY")
tablespace TNMAB_XMLDB_ME_INDX;
create index TNMAB_AGREEMENT_XML_IDX3 on TNMAB_AGREEMENT_XML (AGREEMENT_XML.XMLDATA."LAST_UPDATED")
tablespace TNMAB_XMLDB_ME_INDX;
create index TNMAB_AGREEMENT_XML_IDX4 on TNMAB_AGREEMENT_XML (AGREEMENT_XML.XMLDATA."CREATION_DATE")
tablespace TNMAB_XMLDB_ME_INDX;
--2 Indexes created on Nested Table (Collection)
create index TNMAB_AGREEMENT_XML_NT_IDX1 on SALES_OFFICE_CODES_NT NT(NT.STR_VAL, NT.NESTED_TABLE_ID)
tablespace TNMAB_XMLDB_ME_INDX;
create index TNMAB_AGREEMENT_XML_NT_IDX2 on SHIPPING_PARTIES_NT NT(NT.CUSTOMER_HOLDER.SAP_ID, NT.NESTED_TABLE_ID)
tablespace TNMAB_XMLDB_ME_INDX;
Could you please let us know how we should migrate above Indexes to XMLIndex format.
Specifically, not sure how the last 2 Indexes on Nested Tables is to be defined.
Any help or resources pointing to this would be greatly appreciated.
Thanks for the help,
AuroCan't tell due to using XMLDATA pseudocolumn. Would need a sample XML document structure that can be used to define the XPATH structure and ALSO need the database version you are using (ALL digits) to see if you would need / can use STRUCTURED or UNSTRUCTURED XMLINDEX indexes.
See the XML Index section (http://www.liberidu.com/blog/?page_id=441) on for guidance and/or of course the XMLDB Developers Guide for your database version
http://www.liberidu.com/blog/?page_id=441
XMLIndex (part 1) – The Concepts
XMLIndex (Part 2) – XMLIndex Path Subsetting
XMLIndex (Part 3) – XMLIndex Syntax Dissected
XMLIndex Performance and Fuzzy XPath Searches
Structured XMLIndex (Part 1) – Rules of Numb
Structured XMLIndex (Part 2) – Howto build a structured XMLIndex
Structured XMLIndex (Part 3) – Building Multiple XMLIndex Structures -
Please help me create the indexes for this XML
Hi Mark and others,
What is the way to create the correct index for this kind of XML (I posted earlier)? I created the indexes without using those prefixes without any problems but they do not seem to be used during processing. For 300 statutes, it took about 10 minutes! For the smplier verion, I created indexes and it took no more than 30 seconds to process more than 4000 statutes.
<AllStatuteQueryResponse xmlns="http://crimnet.state.mn.us/mnjustice/statute/service/3.0">
<ns1:Statutes xmlns:ns1="http://crimnet.state.mn.us/mnjustice/statute/messages/3.0">
<ns1:Statutes>
<ns2:StatuteId xmlns:ns2="http://crimnet.state.mn.us/mnjustice/statute/3.0">1</ns2:StatuteId>
<ns3:Chapter xmlns:ns3="http://crimnet.state.mn.us/mnjustice/statute/3.0">84</ns3:Chapter>
<ns4:Section xmlns:ns4="http://crimnet.state.mn.us/mnjustice/statute/3.0">82</ns4:Section>
<ns5:Subdivision xmlns:ns5="http://crimnet.state.mn.us/mnjustice/statute/3.0">1a</ns5:Subdivision>
<ns6:Year xmlns:ns6="http://crimnet.state.mn.us/mnjustice/statute/3.0">0</ns6:Year>
<ns7:LegislativeSessionCode xmlns:ns7="http://crimnet.state.mn.us/mnjustice/statute/3.0">
<ns7:StatuteCode>
<ns7:code>4</ns7:code>
<ns7:description>4</ns7:description>
</ns7:StatuteCode>
</ns7:LegislativeSessionCode>
<ns8:SessionTextIndicator xmlns:ns8="http://crimnet.state.mn.us/mnjustice/statute/3.0">false</ns8:SessionTextIndicator>
<ns9:HeadNoteIndicator xmlns:ns9="http://crimnet.state.mn.us/mnjustice/statute/3.0">false</ns9:HeadNoteIndicator>
<ns10:EffectiveDate xmlns:ns10="http://crimnet.state.mn.us/mnjustice/statute/3.0">1859-01-01</ns10:EffectiveDate>
<ns11:EnactmentDate xmlns:ns11="http://crimnet.state.mn.us/mnjustice/statute/3.0">1859-01-01</ns11:EnactmentDate>
<ns12:RepealedIndicator xmlns:ns12="http://crimnet.state.mn.us/mnjustice/statute/3.0">false</ns12:RepealedIndicator>
<j:DocumentLocationURI xmlns:j="http://www.it.ojp.gov/jxdm/3.0.2">
<j:ID xsi:type="j:TextType" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">http://www.revisor.leg.state.mn.us/stats/84/82.html</j:ID>
</j:DocumentLocationURI>
<ns13:SummaryDescriptionText xmlns:ns13="http://crimnet.state.mn.us/mnjustice/statute/3.0">Snowmobiles-Snowmobile registration</ns13:SummaryDescriptionText>
<ns14:StatuteFunction xmlns:ns14="http://crimnet.state.mn.us/mnjustice/statute/3.0">
<ns14:StatuteIntegrationId>1</ns14:StatuteIntegrationId>
Thanks!
BenHi Mark, here is the schema. I did not register the schema, because when I processed the simpler version, I did not either and I just created the indexes. I did not create an VARRAY in the table. The DDL is simply create table CStatute_XML(id number, xmldoc xmltype).
Schema:
<?xml version="1.0" encoding="UTF-8"?>
<!-- CriMNet -->
<!-- Minnesota Criminal Justice Statute Web Service Data Dictionary -->
<!-- Dave Everson -->
<!-- Version 3.0 -->
<xsd:schema targetNamespace="http://crimnet.state.mn.us/mnjustice/statute/3.0" elementFormDefault="qualified" attributeFormDefault="unqualified" version="3.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://crimnet.state.mn.us/mnjustice/statute/3.0">
<xsd:element name="StatuteCode">
<xsd:annotation>
<xsd:documentation>
This complex type is a generic structure representing code value sets defined in the Minnesota Criminal Justice Statute Service.
A single element of the value set contains both a code value (e.g. F) and a description (e.g. Felony).
The following concepts within the MNCJSS are represented by this complex type:
OffenseSummary
OffenseSummarySeverityLevel
LegislativeSession
Function
OffenseLevel
OffenseSeverityLevel
DetailedOffenseCode
GeneralOffenseCode
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="code" type="xsd:string"/>
<xsd:element name="description" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="StatuteId" type="xsd:integer">
<xsd:annotation>
<xsd:documentation>Primary Key reference to Minnesota Criminal Justice Statute Service disseminated by CriMNet</xsd:documentation>
<xsd:appinfo>Statute.statuteId</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="StatuteIntegrationId" type="xsd:integer">
<xsd:annotation>
<xsd:documentation>Primary Key reference to the StatuteFunction object within the Minnesota Criminal Justice Statute Service disseminated by CriMNet</xsd:documentation>
<xsd:appinfo>StatuteFunction.statuteIntegrationId</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="FunctionCode">
<xsd:annotation>
<xsd:documentation>TBD</xsd:documentation>
<xsd:appinfo>StatuteFunction.Function</xsd:appinfo>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="StatuteCode"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="OffenseSummaryCode">
<xsd:annotation>
<xsd:documentation>TBD</xsd:documentation>
<xsd:appinfo>StatuteFunction.OffenseSummary</xsd:appinfo>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="StatuteCode"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="OffenseSummarySeverityLevelCode">
<xsd:annotation>
<xsd:documentation>TBD</xsd:documentation>
<xsd:appinfo>StatuteFunction.OffenseSummary.OffenseSummarySeverityLevel</xsd:appinfo>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="StatuteCode"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="OffenseLevelCode">
<xsd:annotation>
<xsd:documentation>TBD</xsd:documentation>
<xsd:appinfo>StatuteFunction.OffenseLevel</xsd:appinfo>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="StatuteCode"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="OffenseSeverityLevelCode">
<xsd:annotation>
<xsd:documentation>TBD</xsd:documentation>
<xsd:appinfo>StatuteFunction.OffenseSeverityLevel</xsd:appinfo>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="StatuteCode"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="LegislativeSessionCode">
<xsd:annotation>
<xsd:documentation>TBD</xsd:documentation>
<xsd:appinfo>StatuteChapterSection.LegislativeSession</xsd:appinfo>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="StatuteCode"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="GeneralOffenseCode" nillable="true">
<xsd:annotation>
<xsd:documentation>An integer (1-9) identifier of a general statute category code used for statistical analysis.</xsd:documentation>
<xsd:appinfo>StatuteFunction.DetailedOffenseCode.GeneralOffenseCode</xsd:appinfo>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="StatuteCode"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="DetailedOffenseCode" nillable="true">
<xsd:annotation>
<xsd:documentation>An identification number associated with a statute offense type in the form of nnn.nnn. From a list of 350. Corresponds to the StatuteOffinseTypeText.</xsd:documentation>
<xsd:appinfo>StatuteFunction.DetailedOffenseCode</xsd:appinfo>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="StatuteCode"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Chapter" type="xsd:string">
<xsd:annotation>
<xsd:documentation>A numeric identifier of a chapter within a statute.</xsd:documentation>
<xsd:appinfo>Statute.chapter; StatuteChapterSection.chapter</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="Section" type="xsd:string" nillable="true">
<xsd:annotation>
<xsd:documentation>An integer number identifier of a section of a chapter of a statute.</xsd:documentation>
<xsd:appinfo>Statute.section; StatuteChapterSection.section</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="Subdivision" type="xsd:string" nillable="true">
<xsd:annotation>
<xsd:documentation>An identifier of a subdivision within a code book.</xsd:documentation>
<xsd:appinfo>Statute.subdivision</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="HeadNoteIndicator" type="xsd:boolean">
<xsd:annotation>
<xsd:documentation></xsd:documentation>
<xsd:appinfo>StatuteChapterSection.headNote</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="Year" type="xsd:int">
<xsd:annotation>
<xsd:documentation>TBD</xsd:documentation>
<xsd:appinfo>StatuteChapterSection.year</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="EffectiveDate" type="xsd:date" nillable="true">
<xsd:annotation>
<xsd:documentation>The date a statute came into effect</xsd:documentation>
<xsd:appinfo>Statute.effectiveDate</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="ExpirationDate" type="xsd:date" nillable="true">
<xsd:annotation>
<xsd:documentation>The date a statute was not longer effective.</xsd:documentation>
<xsd:appinfo>Statute.effectiveDate</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="EnactmentDate" type="xsd:date" nillable="true">
<xsd:annotation>
<xsd:documentation>A date a statute was signed into law.</xsd:documentation>
<xsd:appinfo>Statute.enactmentDate</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="RepealedIndicator" type="xsd:boolean">
<xsd:annotation>
<xsd:documentation>A date a statute number was repealed, amended, or renumbered.</xsd:documentation>
<xsd:appinfo>Statute.repealedFlag</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="HeadNote" type="xsd:boolean">
<xsd:annotation>
<xsd:documentation></xsd:documentation>
<xsd:appinfo>Statute.headNote</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="SummaryDescriptionText" type="xsd:string" nillable="true">
<xsd:annotation>
<xsd:documentation>A long description of a statute.</xsd:documentation>
<xsd:appinfo>Statute.summaryText</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="LegislativeText" type="xsd:string" nillable="true">
<xsd:annotation>
<xsd:documentation>The legislative of a statute.</xsd:documentation>
<xsd:appinfo>StatuteChapterSection.legislativeText</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="SessionTextIndicator" type="xsd:boolean">
<xsd:annotation>
<xsd:documentation></xsd:documentation>
<xsd:appinfo>StatuteChapterSection.sessionTextFlag</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="FunctionText" type="xsd:string" nillable="true">
<xsd:annotation>
<xsd:documentation></xsd:documentation>
<xsd:appinfo>StatuteFunction.functionText</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="JuvenileOnlyIndicator" type="xsd:boolean">
<xsd:annotation>
<xsd:documentation>An indicator identifying whether a statute applies to juveniles only.</xsd:documentation>
<xsd:appinfo>StatuteFunction.juvenileOnlyFlag</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="CrimeOfViolenceIndicator" type="xsd:boolean">
<xsd:annotation>
<xsd:documentation>An indicator identifying whether a statute is a crime of violence under Minnesota statute 624 section 712 subdivision 5.</xsd:documentation>
<xsd:appinfo>StatuteFunction.crimeOfViolenceFlag</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="EnhanceableIndicator" type="xsd:boolean">
<xsd:annotation>
<xsd:documentation>An indicator identifying whether the charges are enhanceable by specific factors (the definition of enhanceable is pending review).</xsd:documentation>
<xsd:appinfo>StatuteFunction.enhanceableFlag</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="TargetedMisdemeanorIndicator" type="xsd:boolean">
<xsd:annotation>
<xsd:documentation>An indicator identifying whether a statute is a targeted misdemeanor as defined in Minnnesota Statute 299C.10, subdivision. 1(d).</xsd:documentation>
<xsd:appinfo>StatuteFunction.targetedMisdemeanorFlag</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="MandatoryAppearanceIndicator" type="xsd:boolean">
<xsd:annotation>
<xsd:documentation></xsd:documentation>
<xsd:appinfo>StatuteFunction.mandatoryAppearanceFlag</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="RegisterableOffenseIndicator" type="xsd:boolean">
<xsd:annotation>
<xsd:documentation></xsd:documentation>
<xsd:appinfo>StatuteFunction.registerableOffenseFlag</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="StatuteFunction">
<xsd:annotation>
<xsd:documentation></xsd:documentation>
<xsd:appinfo>StatuteFunction</xsd:appinfo>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="StatuteIntegrationId" />
<xsd:element ref="FunctionCode"/>
<xsd:element ref="FunctionText" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="CrimeOfViolenceIndicator"/>
<xsd:element ref="EnhanceableIndicator"/>
<xsd:element ref="TargetedMisdemeanorIndicator"/>
<xsd:element ref="RegisterableOffenseIndicator"/>
<xsd:element ref="JuvenileOnlyIndicator"/>
<xsd:element ref="MandatoryAppearanceIndicator"/>
<xsd:element ref="OffenseLevelCode" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="GeneralOffenseCode" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="DetailedOffenseCode" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="OffenseSummaryCode" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="OffenseSummarySeverityLevelCode" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="OffenseSeverityLevelCode" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
Query:
first part to get the statute ID numbers,
insert into CriMNet_Statutes
select cs.StatuteId, cs.Chapter, cs.Section, cs.Subdivision, cs.Year, cs.LegCode,
cs.LegDesc, cs.SessionTextIndicator, cs.HeadNoteIndicator,
to_date(cs.EffectiveDate, 'yyyy/mm/dd') as eDate,
to_date(cs.EnactmentDate, 'yyyy/mm/dd') as EnDate,
cs.RepealedIndicator, cs.SummaryDescriptionText
from Cstatute_xml,
xmltable
xmlnamespaces
default 'http://crimnet.state.mn.us/mnjustice/statute/3.0',
--- or 'http://crimnet.state.mn.us/mnjustice/statute/3.0' as "cs"
'http://crimnet.state.mn.us/mnjustice/statute/service/3.0' as "cx",
'http://crimnet.state.mn.us/mnjustice/statute/messages/3.0' as "ns1"
'/cx:AllStatuteQueryResponse/ns1:Statutes/ns1:Statutes'
--- '/AllStatuteQueryResponse//ns:Statutes' --- produces an extra row
passing SXMLDOC
columns
StatuteId varchar2(10) path '//StatuteId',
Chapter varchar2(10) path '//Chapter',
Section varchar2(20) path '//Section',
Subdivision varchar2(20) path '//Subdivision',
Year number path '//Year',
LegCode varchar2(10) path '//LegislativeSessionCode/StatuteCode/code',
LegDesc varchar2(10) path '//LegislativeSessionCode/StatuteCode/description',
SessionTextIndicator varchar2(10) path '//SessionTextIndicator',
HeadNoteIndicator varchar2(10) path '//HeadNoteIndicator',
EffectiveDate varchar2(15) path '//EffectiveDate',
EnactmentDate varchar2(15) path '//EnactmentDate',
RepealedIndicator varchar2(10) path '//RepealedIndicator',
SummaryDescriptionText varchar2(150) path '//SummaryDescriptionText'
) cs;
Second part to get the function code for each statute ID (one ID to many function codes).
declare
v_statuteID number;
v_statuteIDC varchar2(10);
cursor c_cmns is
select statuteid from CriMNet_Statutes;
begin
for v_cmns in c_cmns loop
v_StatuteID := v_cmns.StatuteID;
v_statuteIDC := to_char(v_statuteID);
insert into CriMNet_Statute_Function
select v_StatuteID, cf.* from Cstatute_xml,
xmltable
xmlnamespaces
'http://crimnet.state.mn.us/mnjustice/statute/3.0' as "cs",
'http://crimnet.state.mn.us/mnjustice/statute/service/3.0' as "cx",
'http://crimnet.state.mn.us/mnjustice/statute/messages/3.0' as "ns1"
'for $cxm in /cx:AllStatuteQueryResponse/ns1:Statutes/ns1:Statutes[cs:StatuteId = $val/pStatuteId]/cs:StatuteFunction
return
<cs:CSFunction>
<cs:StatuteIntegrationId>{$cxm//cs:StatuteIntegrationId}</cs:StatuteIntegrationId>
<cs:FunctionCode>{$cxm//cs:FunctionCode/cs:StatuteCode/cs:code}</cs:FunctionCode>
<cs:FunctionDesc>{$cxm//cs:FunctionCode/cs:StatuteCode/cs:description}</cs:FunctionDesc>
<cs:CrimeOfViolenceIndicator>{$cxm//cs:CrimeOfViolenceIndicator}</cs:CrimeOfViolenceIndicator>
<cs:EnhanceableIndicator>{$cxm//cs:EnhanceableIndicator}</cs:EnhanceableIndicator>
<cs:TargetedMisdIndicator>{$cxm//cs:TargetedMisdemeanorIndicator}</cs:TargetedMisdIndicator>
<cs:RegisterableOffIndicator>{$cxm//cs:RegisterableOffenseIndicator}</cs:RegisterableOffIndicator>
<cs:JuvenileOnlyIndicator>{$cxm//cs:JuvenileOnlyIndicator}</cs:JuvenileOnlyIndicator>
<cs:MandatoryAppIndicator>{$cxm//cs:MandatoryAppearanceIndicator}</cs:MandatoryAppIndicator>
<cs:OffenseLevelCode>{$cxm//cs:OffenseLevelCode/cs:StatuteCode/cs:code}</cs:OffenseLevelCode>
<cs:OffenseLevelDesc>{$cxm//cs:OffenseLevelCode/cs:StatuteCode/cs:description}</cs:OffenseLevelDesc>
<cs:GeneralOffenseCode>{$cxm//cs:GeneralOffenseCode/cs:StatuteCode/cs:code}</cs:GeneralOffenseCode>
<cs:GeneralOffenseDesc>{$cxm//cs:GeneralOffenseCode/cs:StatuteCode/cs:description}</cs:GeneralOffenseDesc>
<cs:DetailedOffenseCode>{$cxm//cs:DetailedOffenseCode/cs:StatuteCode/cs:code}</cs:DetailedOffenseCode>
<cs:DetailedOffenseDesc>{$cxm//cs:DetailedOffenseCode/cs:StatuteCode/cs:description}</cs:DetailedOffenseDesc>
<cs:OffenseSummaryCode>{$cxm//cs:OffenseSummaryCode/cs:StatuteCode/cs:code}</cs:OffenseSummaryCode>
<cs:OffenseSummaryDesc>{$cxm//cs:OffenseSummaryCode/cs:StatuteCode/cs:description}</cs:OffenseSummaryDesc>
<cs:OffenseSumSeverityLevelCode>{$cxm//cs:OffenseSummarySeverityLevelCode/cs:StatuteCode/cs:code}</cs:OffenseSumSeverityLevelCode>
<cs:OffenseSumSeverityLevelDesc>{$cxm//cs:OffenseSummarySeverityLevelCode/cs:StatuteCode/cs:description}</cs:OffenseSumSeverityLevelDesc>
</cs:CSFunction>'
passing SXMLDOC, xmlelement("pStatuteId", v_statuteIDC) as "val"
columns
StatuteIntegrationId number path '/cs:CSFunction/cs:StatuteIntegrationId',
FunctionCode varchar2(10) path '/cs:CSFunction/cs:FunctionCode',
FunctionDesc varchar2(30) path '/cs:CSFunction/cs:FunctionDesc',
CrimeOfViolenceIndicator varchar2(10) path '/cs:CSFunction/cs:CrimeOfViolenceIndicator',
EnhanceableIndicator varchar2(10) path '/cs:CSFunction/cs:EnhanceableIndicator',
TargetedMisdIndicator varchar2(10) path '/cs:CSFunction/cs:TargetedMisdIndicator',
RegisterableOffIndicator varchar2(10) path '/cs:CSFunction/cs:RegisterableOffIndicator',
JuvenileOnlyIndicator varchar2(10) path '/cs:CSFunction/cs:JuvenileOnlyIndicator',
MandatoryAppIndicator varchar2(10) path '/cs:CSFunction/cs:MandatoryAppIndicator',
OffenseLevelCode varchar2(10) path '/cs:CSFunction/cs:OffenseLevelCode',
OffenseLevelDesc varchar2(40) path '/cs:CSFunction/cs:OffenseLevelDesc',
GeneralOffenseCode varchar2(10) path '/cs:CSFunction/cs:GeneralOffenseCode',
GeneralOffenseDesc varchar2(60) path '/cs:CSFunction/cs:GeneralOffenseDesc',
DetailedOffenseCode varchar2(10) path '/cs:CSFunction/cs:DetailedOffenseCode',
DetailedOffenseDesc varchar2(60) path '/cs:CSFunction/cs:DetailedOffenseDesc',
OffenseSummaryCode varchar2(10) path '/cs:CSFunction/cs:OffenseSummaryCode',
OffenseSummaryDesc varchar2(60) path '/cs:CSFunction/cs:OffenseSummaryDesc',
OffenseSumSeverityLevelCode varchar2(10) path '/cs:CSFunction/cs:OffenseSumSeverityLevelCode',
OffenseSumSeverityLevelDesc varchar2(30) path '/cs:CSFunction/cs:OffenseSumSeverityLevelDesc'
) cf;
---dbms_output.put_line('Statute ID = ' || v_StatuteID);
end loop;
end;
You mentioned that I should include the namespace in the existsnode function but I did not. I am going to try after including it. Thanks.
Ben -
How to use XML functions in CEP
Hi,
I am trying to implement XML functions in CEP. But i am getting error while using XMl function in config.xml file.
Please provide some help to resolve this issue.
Adapter Class
package com.bea.wlevs.example.adapter.XML_CEP;
import com.bea.wlevs.ede.api.EventProperty;
import com.bea.wlevs.ede.api.EventType;
import com.bea.wlevs.ede.api.EventTypeRepository;
import com.bea.wlevs.ede.api.RunnableBean;
import com.bea.wlevs.ede.api.StreamSender;
import com.bea.wlevs.ede.api.StreamSource;
import com.bea.wlevs.util.Service;
public class XMLAdapter implements RunnableBean, StreamSource {
private String id;
private String name;
private StreamSender eventSender;
private EventTypeRepository etr_;
public XMLAdapter() {
super();
public void run() {
setName("abc");
generateMessage();
public void setId(String id)
this.id = id;
public void setName(String i)
this.name = i;
@Service
public void setEventTypeRepository(EventTypeRepository etr) {
etr_ = etr;
private void generateMessage() {
EventType type = etr_.getEventType("XMLEvent");
EventProperty messageProp = type.getProperty("name");
EventProperty msgProp = type.getProperty("msg");
Object event = type.createEvent();
messageProp.setValue(event, name);
msgProp.setValue(event, "<PDRecord><PDId>6</PDId><PDName>hello1</PDName></PDRecord>");
eventSender.sendInsertEvent(event);
public void setEventSender(StreamSender sender) {
eventSender = sender;
public synchronized void suspend() {
EPN Assembly file
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:osgi="http://www.springframework.org/schema/osgi"
xmlns:wlevs="http://www.bea.com/ns/wlevs/spring" xmlns:jdbc="http://www.oracle.com/ns/ocep/jdbc"
xmlns:spatial="http://www.oracle.com/ns/ocep/spatial"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/osgi
http://www.springframework.org/schema/osgi/spring-osgi.xsd
http://www.bea.com/ns/wlevs/spring
http://www.bea.com/ns/wlevs/spring/spring-wlevs-v11_1_1_3.xsd
http://www.oracle.com/ns/ocep/jdbc
http://www.oracle.com/ns/ocep/jdbc/ocep-jdbc.xsd
http://www.oracle.com/ns/ocep/spatial
http://www.oracle.com/ns/ocep/spatial/ocep-spatial.xsd">
<wlevs:event-type-repository>
<wlevs:event-type type-name="XMLEvent">
<wlevs:properties>
<wlevs:property name="msg" type="xmltype" />
<wlevs:property name="name" type="char" length="256" />
</wlevs:properties>
</wlevs:event-type>
</wlevs:event-type-repository>
<wlevs:adapter advertise="true" id="XML_Adapter"
class="com.bea.wlevs.example.adapter.XML_CEP.XMLAdapter">
<wlevs:listener ref="IPStream" />
<wlevs:instance-property name="id" value="123" />
<wlevs:instance-property name="name" value="Kanika" />
</wlevs:adapter>
<wlevs:processor id="XML_processor" provider="cql">
<wlevs:listener ref="OPStream" />
</wlevs:processor>
<wlevs:channel id="IPStream" event-type="XMLEvent">
<wlevs:listener ref="XML_processor" />
</wlevs:channel>
<wlevs:channel id="OPStream" event-type="XMLEvent">
<wlevs:listener ref="bean" />
</wlevs:channel>
<bean id="bean" class="com.bea.wlevs.example.outputBean.XML_CEP.OutputBean">
</bean>
</beans>
Config.xml file
<?xml version="1.0" encoding="UTF-8"?>
<wlevs:config xmlns:wlevs="http://www.bea.com/ns/wlevs/config/application"
xmlns:jdbc="http://www.oracle.com/ns/ocep/config/jdbc">
<processor>
<name>XML_processor</name>
<rules>
<query id="q1"><![CDATA[
SELECT
XMLEXISTS(
"for $i in /PDRecord RETURN $i/PDName" *// I am getting error at this line*
PASSING BY VALUE
msg as "."
RETURNING CONTENT
) XMLData
FROM IPStream
]]></query>
</rules>
</processor>
</wlevs:config>
Output Bean Class
package com.bea.wlevs.example.outputBean.XML_CEP;
import com.bea.wlevs.ede.api.EventType;
import com.bea.wlevs.ede.api.EventTypeRepository;
import com.bea.wlevs.ede.api.StreamSink;
import com.bea.wlevs.example.event.XML_CEP.DummyEvent;
import com.bea.wlevs.util.Service;
public class OutputBean implements StreamSink {
EventTypeRepository etr_;
@Service
public void setEventTypeRepository(EventTypeRepository etr) {
etr_ = etr;
public void onInsertEvent(Object event) {
EventType eventType = etr_.getEventType(event);
String prop = (String)eventType.getPropertyValue(event, "name");
String prop2 = (String)eventType.getPropertyValue(event, "msg");
System.out.println("Tuple Message: " + prop + ":" + prop2);
Error i am getting is:
<Jun 29, 2011 7:53:59 PM IST> <Emergency> <CQLServer> <BEA-000000> <CREATE QUERY q1 AS
SELECT
XMLQUERY(
"for $i in /PDRecord WHERE $i/PDId <= $x RETURN $i/PDName"
PASSING BY VALUE
msg as ".",
(name+1) AS "x"
RETURNING CONTENT
) XMLData
FROM IPStream
>
<Jun 29, 2011 7:53:59 PM IST> <Emergency> <CQLServer> <BEA-000000> <CREATE QUERY q1 AS
SELECT
XMLQUERY>>(
"for $i in /PDRecord WHERE $i/PDId <= $x RETURN $i/PDName"<<
PASSING BY VALUE
msg as ".",
(name+1) AS "x"
RETURNING CONTENT
) XMLData
FROM IPStream
generic syntax error. The syntax expects STRING token>
<Jun 29, 2011 7:53:59 PM IST> <Emergency> <CQLServerTrace> <BEA-000000> <oracle.cep.parser.SyntaxException: generic syntax error>
<Jun 29, 2011 7:53:59 PM IST> <Error> <CQLProcessor> <BEA-000000> <Failed to create statement [q1].
Invalid statement: "SELECT
XMLQUERY>>(
"for $i in /PDRecord WHERE $i/PDId <= $x RETURN $i/PDName"<<
PASSING BY VALUE
msg as ".",
(name+1) AS "x"
RETURNING CONTENT
) XMLData
FROM IPStream"
Description: generic syntax error
Cause: This DDL command has syntax error
Action: The syntax expects STRING token>
<Jun 29, 2011 7:53:59 PM IST> <Error> <Deployment> <BEA-2045016> <The application context "XML_CEP" could not be started. Could not initialize component
"<unknown>":
Invalid statement: "SELECT
XMLQUERY>>(
"for $i in /PDRecord WHERE $i/PDId <= $x RETURN $i/PDName"<<
PASSING BY VALUE
msg as ".",
(name+1) AS "x"
RETURNING CONTENT
) XMLData
FROM IPStream"
Description: generic syntax error
Cause: This DDL command has syntax error
Action: The syntax expects STRING token>
<Jun 29, 2011 7:54:00 PM IST> <Notice> <Deployment> <BEA-2045001> <The application bundle "XML_CEP" was undeployed successfully>
Thanks in advance.Hi Vikram,
I need some more help from your side.
It would be great help if you will let me know that how to extract the data from particular XML tag.
As of now i want to extract particular XML node by applying that query and the result i am getting is: <applicationID>Engage</applicationID>
I just want to know if I want to extract only data from this XML node i.e Engage instaed of *<applicationID>Engage</applicationID>*
Then what will be the query?
Thanks in Advance -
On commit for mview refresh is not generated in DDL
New design > relational > new table w/ single numeric column
New Oracle 11g physical > new materialized view > on prebuilt table from above > Refresh Clause tab > select ON COMMIT action
-- add a body for grins
resulting XML in saved design:
<?xml version = '1.0' encoding = 'UTF-8'?>
<SnapshotOraclev11g class="oracle.dbtools.crest.model.design.storage.oracle.v11g.SnapshotOraclev11g" name="TABLE_1" id="E092B588-B0A8-437A-4187-9999090405D9" directorySegmentName="seg_0">
<createdBy>kdavis1</createdBy>
<createdTime>2012-07-18 15:28:57 UTC</createdTime>
<ownerDesignName>OTN_Issue_20120717a</ownerDesignName>
<action>ON COMMIT</action>
<defaultSegment>NO</defaultSegment>
<onPrebuiltTable>8332B16F-E06B-86AC-E123-DDA4F5DFF794</onPrebuiltTable>
</SnapshotOraclev11g>
Resulting DDL lacks ON COMMIT:
-- Generated by Oracle SQL Developer Data Modeler 3.1.1.703
-- at: 2012-07-18 11:47:26 EDT
-- site: Oracle Database 11g
-- type: Oracle Database 11g
CREATE TABLE "TABLE_1"
"Column_1" NUMBER
LOGGING
CREATE MATERIALIZED VIEW "TABLE_1"
ON PREBUILT TABLE
AS select sum(foo) from bar
-- Oracle SQL Developer Data Modeler Summary Report:
-- CREATE TABLE 1
-- CREATE INDEX 0
-- ALTER TABLE 0
-- CREATE VIEW 0
-- CREATE PACKAGE 0
-- CREATE PACKAGE BODY 0
-- CREATE PROCEDURE 0
-- CREATE FUNCTION 0
-- CREATE TRIGGER 0
-- ALTER TRIGGER 0
-- CREATE STRUCTURED TYPE 0
-- CREATE COLLECTION TYPE 0
-- CREATE CLUSTER 0
-- CREATE CONTEXT 0
-- CREATE DATABASE 0
-- CREATE DIMENSION 0
-- CREATE DIRECTORY 0
-- CREATE DISK GROUP 0
-- CREATE ROLE 0
-- CREATE ROLLBACK SEGMENT 0
-- CREATE SEQUENCE 0
-- CREATE MATERIALIZED VIEW 1
-- CREATE SYNONYM 0
-- CREATE TABLESPACE 0
-- CREATE USER 0
-- DROP TABLESPACE 0
-- DROP DATABASE 0
-- ERRORS 0
-- WARNINGS 0
Posts reviewed: (materialized && view) || mview || mvYes but then shouldn't "Refresh Type" be blank (instead of FAST) like "Refresh Action" is blank by default.
Or better yet, you already fill the mview name upon selection of a table for on prebuilt -- so should you select refresh YES upon choosing a type and/or action?
Seems to be an inconsistency here. -
Analysis Service Execute DDL Task throwing error with SourceType Variable
Hi,
I have Configuring Analysis Services Execute DDL Task to use Variable and Process Data(xmla Script) like below:
When I execute this task I get the below error message:
[Analysis Services Execute DDL Task] Error: The -->
text node at line 23, column 3 cannot appear inside the DataSource element (namespace http://schemas.microsoft.com/analysisservices/2003/engine) under Envelope/Body/Execute/Command/Batch/Parallel/Process. This element can
only have text nodes containing white-space characters.
Can anyone please let me know how to resolve this.If I run using the sourceType "Direct Input", the Analysis Execute DDL Task runs fine, but if I use the sourcetype as variable its throws the error. And below is the xmla script
Here is my Package look and the xmla script; its failing at "ProcessAdd" Analysis Execute DDL task:
"SELECT '<Batch xmlns=\"http://schemas.microsoft.com/analysisservices/2003/engine\">
<ErrorConfiguration xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:ddl2=\"http://schemas.microsoft.com/analysisservices/2003/engine/2\" xmlns:ddl2_2=\"http://schemas.microsoft.com/analysisservices/2003/engine/2/2\" xmlns:ddl100_100=\"http://schemas.microsoft.com/analysisservices/2008/engine/100/100\" xmlns:ddl200=\"http://schemas.microsoft.com/analysisservices/2010/engine/200\" xmlns:ddl200_200=\"http://schemas.microsoft.com/analysisservices/2010/engine/200/200\" xmlns:ddl300=\"http://schemas.microsoft.com/analysisservices/2011/engine/300\" xmlns:ddl300_300=\"http://schemas.microsoft.com/analysisservices/2011/engine/300/300\" xmlns:ddl400=\"http://schemas.microsoft.com/analysisservices/2012/engine/400\" xmlns:ddl400_400=\"http://schemas.microsoft.com/analysisservices/2012/engine/400/400\">
<KeyNotFound>IgnoreError</KeyNotFound>
</ErrorConfiguration>
<Parallel>
<Process xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:ddl2=\"http://schemas.microsoft.com/analysisservices/2003/engine/2\" xmlns:ddl2_2=\"http://schemas.microsoft.com/analysisservices/2003/engine/2/2\" xmlns:ddl100_100=\"http://schemas.microsoft.com/analysisservices/2008/engine/100/100\" xmlns:ddl200=\"http://schemas.microsoft.com/analysisservices/2010/engine/200\" xmlns:ddl200_200=\"http://schemas.microsoft.com/analysisservices/2010/engine/200/200\" xmlns:ddl300=\"http://schemas.microsoft.com/analysisservices/2011/engine/300\" xmlns:ddl300_300=\"http://schemas.microsoft.com/analysisservices/2011/engine/300/300\" xmlns:ddl400=\"http://schemas.microsoft.com/analysisservices/2012/engine/400\" xmlns:ddl400_400=\"http://schemas.microsoft.com/analysisservices/2012/engine/400/400\">
<Object>
<DatabaseID>IIS_Version2</DatabaseID>
<DimensionID>Application</DimensionID>
</Object>
<Type>ProcessAdd</Type>
<DataSource xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:ddl2=\"http://schemas.microsoft.com/analysisservices/2003/engine/2\" xmlns:ddl2_2=\"http://schemas.microsoft.com/analysisservices/2003/engine/2/2\" xmlns:ddl100_100=\"http://schemas.microsoft.com/analysisservices/2008/engine/100/100\" xmlns:ddl200=\"http://schemas.microsoft.com/analysisservices/2010/engine/200\" xmlns:ddl200_200=\"http://schemas.microsoft.com/analysisservices/2010/engine/200/200\" xmlns:ddl300=\"http://schemas.microsoft.com/analysisservices/2011/engine/300\" xmlns:ddl300_300=\"http://schemas.microsoft.com/analysisservices/2011/engine/300/300\" xmlns:ddl400=\"http://schemas.microsoft.com/analysisservices/2012/engine/400\" xmlns:ddl400_400=\"http://schemas.microsoft.com/analysisservices/2012/engine/400/400\" xmlns:dwd=\"http://schemas.microsoft.com/DataWarehouse/Designer/1.0\" xsi:type=\"RelationalDataSource\" dwd:design-time-name=\"1a3cb292-9bce-4c59-a182-177d6b3506ff\" xmlns=\"http://schemas.microsoft.com/analysisservices/2003/engine\">
<ID>IISDW</ID>
<Name>IISDW</Name>
<ConnectionString>Provider=SQLNCLI11.1;Data Source=CO1MSFTSQLHKT02;Integrated Security=SSPI;Initial Catalog=IISDW</ConnectionString>
<Timeout>PT0S</Timeout>-->
</DataSource>
<DataSourceView xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:ddl2=\"http://schemas.microsoft.com/analysisservices/2003/engine/2\" xmlns:ddl2_2=\"http://schemas.microsoft.com/analysisservices/2003/engine/2/2\" xmlns:ddl100_100=\"http://schemas.microsoft.com/analysisservices/2008/engine/100/100\" xmlns:ddl200=\"http://schemas.microsoft.com/analysisservices/2010/engine/200\" xmlns:ddl200_200=\"http://schemas.microsoft.com/analysisservices/2010/engine/200/200\" xmlns:ddl300=\"http://schemas.microsoft.com/analysisservices/2011/engine/300\" xmlns:ddl300_300=\"http://schemas.microsoft.com/analysisservices/2011/engine/300/300\" xmlns:ddl400=\"http://schemas.microsoft.com/analysisservices/2012/engine/400\" xmlns:ddl400_400=\"http://schemas.microsoft.com/analysisservices/2012/engine/400/400\" xmlns:dwd=\"http://schemas.microsoft.com/DataWarehouse/Designer/1.0\" dwd:design-time-name=\"b0b61205-c64d-4e34-afae-6d4d48b93fb3\" xmlns=\"http://schemas.microsoft.com/analysisservices/2003/engine\">
<ID>IISDW</ID>
<Name>IISDW</Name>
<DataSourceID>IISDW</DataSourceID>
<Schema>
<xs:schema id=\"IISDW_x0020_1\" xmlns=\"\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\" xmlns:msprop=\"urn:schemas-microsoft-com:xml-msprop\">
<xs:element name=\"IISDW_x0020_1\" msdata:IsDataSet=\"true\" msdata:UseCurrentLocale=\"true\" msprop:design-time-name=\"72037318-e316-469d-9a45-a10c77709b39\">
<xs:complexType>
<xs:choice minOccurs=\"0\" maxOccurs=\"unbounded\">
<xs:element name=\"Application\" msprop:design-time-name=\"7f579e7e-e8b7-4a9d-8a93-a255fccbbfbe\" msprop:IsLogical=\"True\" msprop:FriendlyName=\"Application\" msprop:DbTableName=\"Application\" msprop:TableType=\"View\" msprop:Description=\"\" msprop:QueryDefinition=\"SELECT a.Application, DATEADD([hour], DATEDIFF([hour], 0, a.[Timestamp]), 0) AS [Timestamp], a.ServerName, CAST(a.ServerName AS char(3)) AS DataCenter, a.CS_URI_Stem, CAST(HashBytes(''MD5'', 
 a.Application + a.ServerName + a.CS_URI_Stem + CAST(DATEADD([hour], DATEDIFF([hour], 0, a.[Timestamp]), 0) AS varchar(24))) AS uniqueidentifier) AS Server_URI_Identity
FROM IIS_6_OLD AS a LEFT OUTER JOIN
 Dimension_Pointer AS b ON a.Application = b.Application
WHERE (b.ProcessedFlag = 0) AND (a.Application IN ("+(DT_WSTR,100) @[User::strDistinctApplication]+"))
GROUP BY a.Application, DATEADD([hour], DATEDIFF([hour], 0, a.[Timestamp]), 0), a.ServerName, a.CS_URI_Stem\" msprop:QueryBuilder=\"SpecificQueryBuilder\">
<xs:complexType>
<xs:sequence>
<xs:element name=\"Application\" msprop:design-time-name=\"f3074e98-4a82-4bc5-a818-916203f7758b\" msprop:DbColumnName=\"Application\" msprop:FriendlyName=\"Application\" minOccurs=\"0\">
<xs:simpleType>
<xs:restriction base=\"xs:string\">
<xs:maxLength value=\"255\" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name=\"Timestamp\" msdata:ReadOnly=\"true\" msprop:design-time-name=\"2662e3a8-8b1a-4d77-aecb-575329b84dc1\" msprop:DbColumnName=\"Timestamp\" msprop:FriendlyName=\"Timestamp\" type=\"xs:dateTime\" />
<xs:element name=\"ServerName\" msprop:design-time-name=\"ced26d49-cd6e-4073-a40c-ff5ef70e4ef1\" msprop:DbColumnName=\"ServerName\" msprop:FriendlyName=\"ServerName\" minOccurs=\"0\">
<xs:simpleType>
<xs:restriction base=\"xs:string\">
<xs:maxLength value=\"255\" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name=\"DataCenter\" msdata:ReadOnly=\"true\" msprop:design-time-name=\"4583e15a-dcf1-45a2-a30b-bd142ca8b778\" msprop:DbColumnName=\"DataCenter\" msprop:FriendlyName=\"DataCenter\" minOccurs=\"0\">
<xs:simpleType>
<xs:restriction base=\"xs:string\">
<xs:maxLength value=\"3\" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name=\"CS_URI_Stem\" msprop:design-time-name=\"10db5a79-8d50-49d2-9376-a3b4d19864b9\" msprop:DbColumnName=\"CS_URI_Stem\" msprop:FriendlyName=\"CS_URI_Stem\" minOccurs=\"0\">
<xs:simpleType>
<xs:restriction base=\"xs:string\">
<xs:maxLength value=\"4000\" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name=\"Server_URI_Identity\" msdata:DataType=\"System.Guid, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\" msdata:ReadOnly=\"true\" msprop:design-time-name=\"018ede0a-e15e-47c2-851b-f4431e8c839c\" msprop:DbColumnName=\"Server_URI_Identity\" msprop:FriendlyName=\"Server_URI_Identity\" type=\"xs:string\" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:unique name=\"Constraint1\" msprop:IsLogical=\"True\" msdata:PrimaryKey=\"true\">
<xs:selector xpath=\".//Application\" />
<xs:field xpath=\"Server_URI_Identity\" />
<xs:field xpath=\"Timestamp\" />
</xs:unique>
</xs:element>
</xs:schema>
<IISDW_x0020_1 xmlns=\"\" />
</Schema>
</DataSourceView>
<WriteBackTableCreation>UseExisting</WriteBackTableCreation>
</Process>
</Parallel>
</Batch>' as XMLAScript_ProcessData" -
Is JAXB the best solution to store XML schema in databse
Hi, i have a doubt regarding which is better way to store XML schema to database.
I have looked on JAXB, DOM, SAX.
I should be able to modify the database and store back the changes in XML schema..
i am really consfused about this.
plz suggest me
thanxThank you for your reply
As per as I know JAXB take XML schema as basis to
create tables in database and store the XML data
according to that . I want to store the XML Data in
the database structured according to XML schema
defined by me.I'm not sure how a schema would impact this. Schema is a data definition that constraints a given XML data document. The XML itself is stored as a string. Databases like Oracle now have XML column types and allow you to use XML querying languages and x-Path in normal SQL queries.
There are 2 types of mapping from XML to datbase
Table space and object relational
A tablespace is conceptually similar to a namespace. Object relational mappers go from objects to relational databases and back. I do not see how either of these two concepts are mutually exclusive. And the latter makes no sense if you talking about an object database. There is no O/R mapping because there is no relational database, it's an object database.
I want to do object-relational mapping from XML to
o object oriented database . and the modifications
done on the datbase want to store again in XML. As
per as I know JAXB give us classes as per the XML
schema and we can write DDL to store the data in
databse
JAXB is for marshalling and unmarshalling Java objects to and from XML. The XML itself can be stored in any LOB database column.
Is it the right approach or do you have any better
idea?I still do not really understand what you are trying to do. It seems like you have a bit too much technology soup to consume. What are the actual requirements?
- Saish
Maybe you are looking for
-
How can I remove an app claiming to be anti virus, that downloaded itself from e-mail?
O On Friday, May 21; I was reading my e-mail. I opened a message from a regular contact and immediately an application opened claiming to be "the latest Anti Virus program for Mac". It will not operate until you register, and it is $59.95 to register
-
after updating to 6.0.1 on my iphone 4 ... the wifi bearly works if at all and it dosent vibrate at all .. all settings are switched on ... any tips or ideas to these matters?
-
Want to change the text of a coloumn dynamically in module pool program
Hi to all experts, I need to change the text in a table control( of a column)of a module pool program dynamically ....depending on the company cod e.
-
Hi All, I have configured Alert and receiving alert successfully as an Email. In my sceanario, i m triggering alert in BPM and need to pass payload as an Email body so used container. and ticked Dynamic Text option in ALRTCATDEF. So now I m getting e
-
hi gurus, i had a confusion in this area. please let me know the difference. as per as my knowledge in KP06 u have to give ur COST ELEMENT and COST CENTER, in KP26 we have to give ATY TYPE and COST CENTER. in above senario, we have to do planning