Problems with XMLType in 9.2.0.2
Hi,
My database has gone somehow corrupt, I guess. After some backup/recovery/cloning cycles I'm not able to execute code that has previously run without problems.
Following line:
xKomunikatXML := XMLType.CreateXml(CONVERT(pxKomunikat,'EE8ISO8859P2','EE8ISO8859P2'));
or even:
xKomunikatXML := XMLType.CreateXML(pxKomunikat);
causes errors:
ORA-01001: invalid cursor
ORA-21700: object does not exist or is marked for delete
What can be done about it?
Step 1
Take all the applicable steps in this support article. That's the starting point for any further efforts to solve the problem.
Step 2
If you're running OS X 10.8.5 or earlier, from the menu bar select
▹ System Preferences... ▹ Accessibility
If the checkbox at the bottom marked
Enable access for assistive devices
is checked, uncheck it and test.
If you're running OS X 10.9 or later, select
▹ System Preferences... ▹ Security & Privacy ▹ Privacy ▹ Accessibility
If any applications are listed on the right and have a checked box next to them, uncheck all the boxes and test. You may first have to click the padlock icon in the lower left corner of the window and authenticate as an administrator to unlock the settings.
Step 3
Disconnect all wired peripherals except those needed to boot, if any. Be sure to disconnect all USB hubs. If you use a keyboard or mouse plugged into a hub, plug the devices directly into a built-in USB port and remove the hub. Test.
Step 4
If you have more than one user account, you must be logged in as an administrator for this step.
Launch the Console application in any of the following ways:
☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
☞ Open LaunchPad. Click Utilities, then Console in the icon grid.
In the Console window, look under the heading DIAGNOSTIC AND USAGE INFORMATION on the left for Diagnostic and Usage Messages. If you don't see that heading, select
View ▹ Show Log List
from the menu bar. In the search box in the window's toolbar, enter "powerd" (without the quotes.) Select the last few messages that appear, if any, and copy them to the Clipboard by pressing the key combination command-C. Paste into a reply to this message (command-V).
Similar Messages
-
Problems with XMLType and namespace
Dear subscribers:
I have been using XMLType successfully with simple XMLs - without namespaces. Now I must handle messages with "xmlns" and it seems XMLType is failing.
I tested the following XML, extracted from w3c.org examples:
<?xml version="1.0"?>
<bk:book xmlns:bk=''urn:loc.gov:books''
xmlns:isbn=''urn:ISBN:0-395-36341-6''>
<bk:title>Cheaper by the Dozen</bk:title>
<isbn:number>1568491379</isbn:number>
</bk:book>
The result of xmlt.getRootElement() is book.
However, the use of xmlt.extract( 'book' ) returns an empty object:
xmlt1 := xmlt.extract( 'book' );
dbms_output.put_line( 'StringVal: ' || xmlt1.getStringVal() );
ORA-30625: method dispatch on NULL SELF argument is disallowed
The following usages also raise errors:
xmlt1 := xmlt.extract( 'bk:book' );
ORA-31011: XML parsing failed ORA-19202: Error occurred in XML processing LPX-00601: Invalid token in: 'bk:book' ORA-06512: at "SYS.XMLTYPE", line 111
xmlt1 := xmlt.extract( 'bk::book' );
ORA-31011: XML parsing failed ORA-19202: Error occurred in XML processing LPX-00601: Invalid token in: 'bk::book' ORA-06512: at "SYS.XMLTYPE", line 111
xmlt1 := xmlt.extract( 'book', 'bk' );
ORA-31013: Invalid XPATH expression ORA-06512: at "SYS.XMLTYPE", line 119
I am using Oracle version 10.2.0.1.0. Had someone also faced this problem?
The code I used to test is at the end of this message.
Thanks in advance
====================================
DECLARE
xml varchar2(32000);
xmlt XMLType;
xmlt1 XMLType;
root varchar2(3000);
BEGIN
--Example from w3c.org
xml := '<?xml version="1.0"?>
<bk:book xmlns:bk=''urn:loc.gov:books''
xmlns:isbn=''urn:ISBN:0-395-36341-6''>
<bk:title>Cheaper by the Dozen</bk:title>
<isbn:number>1568491379</isbn:number>
</bk:book>';
xmlt := XMLType( xml );
root := xmlt.getRootElement();
dbms_output.put_line( 'StringVal: ' || xmlt.getStringVal() ); -- The XML is ok
dbms_output.put_line( 'Namespace: ' || xmlt.getNameSpace() ); -- Returns NULL
dbms_output.put_line( 'Root element: ' || root ); -- Returns book
dbms_output.put_line( 'Exists: ' || xmlt.existsNode('book') ); -- Returns ZERO
xmlt1 := xmlt.extract( 'bk:book' ); Raises error (see above)
xmlt1 := xmlt.extract( 'bk::book' ); Raises error (see above)
xmlt1 := xmlt.extract( 'book', 'bk' ); Raises error (see above)
--xmlt1 := xmlt.extract( 'book' );
dbms_output.put_line( 'StringVal: ' || xmlt1.getStringVal() ); Raises error
END;
/If you put your XML into a namespace then you also need to extract from that namespace.... e.g.
No namespace...
SQL> select t.xml.extract('myroot')
2 from (select XMLTYPE('<myroot><mychild>test</mychild></myroot>') as xml from dual) t
3 ;
T.XML.EXTRACT('MYROOT')
<myroot>
<mychild>test</mychild>
</myroot>Put XML in namespace and now the extract returns nothing...
SQL> ed
Wrote file afiedt.buf
1 select t.xml.extract('myroot')
2* from (select XMLTYPE('<myroot xmlns="fred"><mychild>test</mychild></myroot>') as xml from dual) t
3 /
T.XML.EXTRACT('MYROOT')
--------------------------------------------------------------------------------------------------------Extract, specifying the namespace to extract from and now returns the result...
SQL> ed
Wrote file afiedt.buf
1 select t.xml.extract('myroot', 'xmlns="fred"')
2* from (select XMLTYPE('<myroot xmlns="fred"><mychild>test</mychild></myroot>') as xml from dual) t
SQL> /
T.XML.EXTRACT('MYROOT','XMLNS="FRED"')
<myroot xmlns="fred">
<mychild>test</mychild>
</myroot>
SQL>;) -
Character set problems with xmltype and SQLdeveloper
Hi all,
Using SQL DEveloper v.3.2.20.09 on Windows XP and connecting to Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production.
SQL Developer encoding is set to Cp1252 (my understanding is this has nothing to do with nls_lang and used for encoding of files in sqldeveloper)
SQL Developer NLS Language params set to Canada English.
Database NLS parameters are:
"PARAMETER" "VALUE"
"NLS_LANGUAGE" "AMERICAN"
"NLS_TERRITORY" "AMERICA"
"NLS_CURRENCY" "$"
"NLS_ISO_CURRENCY" "AMERICA"
"NLS_NUMERIC_CHARACTERS" ".,"
"NLS_CHARACTERSET" "AL32UTF8"
"NLS_CALENDAR" "GREGORIAN"
"NLS_DATE_FORMAT" "DD-MON-RR"
"NLS_DATE_LANGUAGE" "AMERICAN"
"NLS_SORT" "BINARY"
"NLS_TIME_FORMAT" "HH.MI.SSXFF AM"
"NLS_TIMESTAMP_FORMAT" "DD-MON-RR HH.MI.SSXFF AM"
"NLS_TIME_TZ_FORMAT" "HH.MI.SSXFF AM TZR"
"NLS_TIMESTAMP_TZ_FORMAT" "DD-MON-RR HH.MI.SSXFF AM TZR"
"NLS_DUAL_CURRENCY" "$"
"NLS_COMP" "BINARY"
"NLS_LENGTH_SEMANTICS" "BYTE"
"NLS_NCHAR_CONV_EXCP" "FALSE"
"NLS_NCHAR_CHARACTERSET" "AL16UTF16"
"NLS_RDBMS_VERSION" "11.2.0.2.0"
I didn't have an NLS_LANG user env variable set, so i set it to "AMERICAN_AMERICA.WE8MSWIN1252"
Problem i'm having is editing my xmltype data... i have some french accented characters in there, but when saved through SQLDeveloper, they come out as:
Étape par étape -> Étape par étape
I do have an encoding on the xml file in the xmltype column set to UTF-8... but from what i read, this has no effect when reading or writing in 11g...
I ran a dump(col, 1016) on my table and got the following:
Typ=58 Len=2037: 0,0,0,1,10,4,8c,a8,0,0,0,1,10,8c,ff,b8,0,0,0,1,11,2,2,f8,0,0,0,1,10,e1,a9,20,3b,9a,ca,0,0,0,f,a0,0,0,f,a0,0,1,0,4,0,0,0,1,9,84,d5,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,10,f,93,48,0,0,0,1,10,88,0,8,40,b3,8f,0,0,0,1,41,0,0,0,0,0,0,0,0,0,0,0,1,10,88,ab,b8,0,0,1,40,0,0,0,0,0,0,0,1,10,88,ab,d8,0,0,0,1,10,f,93,48,0,0,40,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,40,68,6b,78,73,2d,68,65,61,70,2d,63,0,0,0,0,0,0,7f,ff,7f,ff,80,0,80,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,0,0,0,1,10,8d,0,b8,0,0,0,1,10,8d,0,b8,0,0,0,0,0,0,0,28,0,0,0,1,10,8d,0,d0,0,0,0,1,10,8d,0,d0,0,0,0,0,0,0,0,38,0,0,0,1,10,8d,0,e8,0,0,0,1,10,8d,0,e8,0,0,0,0,0,0,0,58,0,0,0,1,10,8d,1,0,0,0,0,1,10,8d,1,0,0,0,0,0,0,0,1,18,0,0,0,1,10,8d,1,18,0,0,0,1,10,8d,1,18,0,0,0,0,0,0,4,18,0,0,0,1,10,8d,1,30,0,0,0,1,10,8d,1,30,0,0,0,0,0,0,10,18,0,0,0,1,10,8d,1,48,0,0,0,1,10,8d,1,48,d0,b3,8f,0,0,0,fe,a9,0,0,0,1,10,8d,0,18,0,0,0,1,10,f,94,e0,0,0,0,1,10,ff,aa,98,0,0,0,1,10,8d,8,98,d0,b3,8f,0,0,0,7,1,0,0,0,0,0,0,0,0,0,0,0,1,10,8d,8,b8,0,0,0,1,10,f,84,48,0,0,0,1,10,8d,8,c0,0,b3,8f,0,0,0,0,31,0,0,0,0,0,0,0,0,0,0,0,1,8,fc,ac,8,d0,b3,8f,0,0,0,fe,41,0,0,0,1,10,8d,1,58,0,0,0,1,10,f,93,48,0,0,0,1,10,f,83,a0,0,0,0,1,11,35,a9,0,d0,b3,8f,0,0,0,fe,19,0,0,0,0,0,0,0,0,0,0,0,1,10,f,84,48,0,0,0,1,10,f,84,48,50,0,4,1,0,0,0,18,0,0,0,58,0,4,1,0,0,0,30,0,0,0,60,0,4,1,0,0,0,48,0,0,0,68,0,4,1,0,0,0,60,0,0,0,70,0,4,1,0,0,0,78,0,0,0,78,0,1,1,0,0,0,90,0,0,0,90,0,2,2,0,0,0,a8,0,0,0,a8,0,17,1,1,3,69,2,0,0,0,d0,0,0,0,c0,0,11,1,1,3,69,2,0,0,0,f8,0,0,0,d8,0,20,1,1,3,69,2,0,0,1,20,0,0,1,0,0,14,1,1,3,69,2,0,0,1,48,0,0,1,18,0,40,1,1,3,69,2,0,0,1,70,0,0,1,60,0,28,1,1,3,69,2,0,0,1,98,0,0,1,90,0,3f,1,1,3,69,2,0,0,1,c0,0,0,1,d0,0,1a,1,1,3,69,2,0,0,1,e8,0,0,1,f0,0,28,1,1,3,69,2,0,0,2,10,0,0,2,20,0,2b,1,1,3,69,2,0,0,2,38,0,0,2,50,0,33,1,1,c0,b3,8f,0,0,0,10,81,0,0,0,1,10,8d,1,58,0,0,0,1,10,f,93,48,0,0,0,1,10,8d,4d,30,0,0,0,1,10,8d,13,88,d0,b3,8f,0,0,0,10,59,0,0,0,0,0,0,0,0,0,0,0,1,10,8d,13,a8,0,0,0,1,11,0,98,88,0,0,0,1,10,8d,13,c8,0,b3,8f,0,0,0,0,41,0,0,0,0,0,0,0,0,0,0,0,1,8,fc,ac,8,0,0,0,0,0,0,0,0,0,0,0,1,10,8d,3,c0,80,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b3,8f,0,0,0,0,29,0,0,0,1,10,8d,3,40,0,0,0,1,8,fc,ac,50,0,0,0,b7,0,2,43,31,0,0,0,0,0,0,0,0,0,b3,8f,0,0,0,0,99,0,0,0,1,10,8d,3,80,0,0,0,1,9,10,e7,50,1,0,0,0,0,0,0,0,0,0,0,b7,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,7,c7,bf,b8,c0,b3,8f,0,0,0,18,79,0,0,0,1,10,8d,1,58,0,0,0,1,10,f,93,48,0,0,0,0,0,0,0,0,0,0,0,1,10,8d,1c,80,d0,b3,8f,0,0,0,18,51,0,0,0,0,0,0,0,0,0,0,0,1,10,8d,1c,a0,0,0,0,1,10,f,84,48,0,0,0,1,10,8d,1c,a8,10,b3,8f,0,0,0,18,29,0,0,0,0,0,0,0,0,0,0,0,1,8,fb,fe,44,0,0,0,0,0,0,0,0,0,0,0,1,10,8d,1c,68,0,0,0,0,0,0,0,0,0,30,0,30,0,0,0,4,0,0,0,1,10,8d,24,80,0,0,0,1,10,8d,4,88,0,0,0,1,10,8d,4,58,0,0,0,1,10,8d,4,a0,0,0,0,1,10,8d,1c,68,0,0,0,1,10,88,4,f0,0,0,0,1,10,8d,49,38,0,0,0,1,20,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,10,8d,40,88,0,0,0,1,9,10,e6,5c,0,0,0,1,10,88,6,0,0,0,0,1,10,8d,38,a0,0,0,0,2,10,8d,0,2,0,0,0,0,0,0,0,0,0,0,0,1,10,8d,40,a8,0,b3,8f,0,0,0,0,69,0,0,0,1,10,88,14,c8,0,0,0,1,10,8d,38,a0,0,0,0,2,20,0,0,2,0,0,0,0,0,0,0,0,0,0,0,1,10,8d,40,c8,0,0,0,0,0,0,0,0,0,0,0,1,10,88,14,30,0,0,0,1,10,8d,38,a0,0,0,0,2,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,1,10,8d,40,e8,0,0,0,0,0,0,0,0,0,b3,8f,0,0,0,0,59,0,0,0,1,10,8d,4,f8,0,0,0,1,8,fd,b9,e0,0,0,0,1,11,0,83,a8,0,0,0,1,11,0,83,a8,0,0,0,1,11,0,83,c0,0,0,0,1,11,0,7b,98,0,0,0,1,10,8d,26,c0,0,0,0,1,10,8d,26,c0,0,0,0,1,8,fd,b9,e0,0,0,8,0,ac,64,61,74,0,b3,8f,0,0,0,4,29,0,0,0,1,10,8d,5,60,0,0,0,1,8,fb,fe,44,0,0,0,0,0,0,0,0,0,0,0,1,10,8d,9,e0,0,0,0,0,0,0,0,0,0,40,0,40,0,0,0,0,0,0,0,1,10,8d,9,f8,0,0,0,1,10,8d,6,0,0,0,0,1,10,8d,5,d0,0,0,0,1,10,8d,6,18,0,0,0,1,10,8d,9,e0,48,45,4d,41,5f,50,52,45,53,45,4e,54,22,23,66,65,35,64,36,61,61,30,35,64,65,62,64,64,65,61,20,23,33,0,0,0,0,0,0,0,2,0,0,4,0,0,0,3,0,0,0,10,44,2,f,a0,1,0,f,d0,41,0,30,d,0,18,d,0,10,0,0,0,0,0,0,3,0,0,0,2,3,80
I find it odd it doesnt tell me what character set is used. If i run a dump 1016 on a varchar2 on the same table, i get:
Typ=1 Len=14 CharacterSet=AL32UTF8: 53,74,65,c3,a9,70,68,61,6e,65,c3,a9,c3,a0
Any ideas? This is frustrating.... xml data gets corrupted everytime it's edited in SQLDeveloper.
Thanks for the helpThanks for the reply...
create table sample_charset(theString varchar2(2 char), theXml xmltype);
insert into sample_charset values('éà',xmltype('<xml>éà</xml>'));
commit;
select * from sample_charset;
"THESTRING" "THEXML"
"éà" <xml>éà </xml>
select dump(theString, 1016) as theStringDump, dump(theXml,1016) as theXmlDump from sample_charset;
"THESTRINGDUMP" "THEXMLDUMP"
"Typ=1 Len=4 CharacterSet=AL32UTF8: c3,a9,c3,a0"
"Typ=58 Len=120: 0,0,0,1,10,4,8c,a8,0,0,0,1,10,e1,a8,60,0,0,0,1,10,dc,36,f8,0,0,0,1,10,95,bf,28,3b,9a,ca,0,0,0,f,a0,0,0,f,a0,0,1,0,4,0,0,0,1,9,84,d5,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,10,f,91,28,0,0,0,1,10,db,a8,b8" -
Problem with XMLTABLE and LEFT OUTER JOIN
Hi all.
I have one problem with XMLTABLE and LEFT OUTER JOIN, in 11g it returns correct result but in 10g it doesn't, it is trated as INNER JOIN.
SELECT * FROM v$version;
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
"CORE 11.2.0.1.0 Production"
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
--test for 11g
CREATE TABLE XML_TEST(
ID NUMBER(2,0),
XML XMLTYPE
INSERT INTO XML_TEST
VALUES
1,
XMLTYPE
<msg>
<data>
<fields>
<id>g1</id>
<dat>data1</dat>
</fields>
</data>
</msg>
INSERT INTO XML_TEST
VALUES
2,
XMLTYPE
<msg>
<data>
<fields>
<id>g2</id>
<dat>data2</dat>
</fields>
</data>
</msg>
INSERT INTO XML_TEST
VALUES
3,
XMLTYPE
<msg>
<data>
<fields>
<id>g3</id>
<dat>data3</dat>
</fields>
<fields>
<id>g4</id>
<dat>data4</dat>
</fields>
<fields>
<dat>data5</dat>
</fields>
</data>
</msg>
SELECT
t.id,
x.dat,
y.seqno,
y.id_real
FROM
xml_test t,
XMLTABLE
'/msg/data/fields'
passing t.xml
columns
dat VARCHAR2(10) path 'dat',
id XMLTYPE path 'id'
)x LEFT OUTER JOIN
XMLTABLE
'id'
passing x.id
columns
seqno FOR ORDINALITY,
id_real VARCHAR2(30) PATH '.'
)y ON 1=1
ID DAT SEQNO ID_REAL
1 data1 1 g1
2 data2 1 g2
3 data3 1 g3
3 data4 1 g4
3 data5 Here's everything fine, now the problem:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi
PL/SQL Release 10.2.0.1.0 - Production
"CORE 10.2.0.1.0 Production"
TNS for HPUX: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
--exactly the same environment as 11g (tables and rows)
SELECT
t.id,
x.dat,
y.seqno,
y.id_real
FROM
xml_test t,
XMLTABLE
'/msg/data/fields'
passing t.xml
columns
dat VARCHAR2(10) path 'dat',
id XMLTYPE path 'id'
)x LEFT OUTER JOIN
XMLTABLE
'id'
passing x.id
columns
seqno FOR ORDINALITY,
id_real VARCHAR2(30) PATH '.'
)y ON 1=1
ID DAT SEQNO ID_REAL
1 data1 1 g1
2 data2 1 g2
3 data3 1 g3
3 data4 1 g4As you can see in 10g I don't have the last row, it seems that Oracle 10g doesn't recognize the LEFT OUTER JOIN.
Is this a bug?, Metalink says that sometimes we can have an ORA-0600 but in this case there is no error returned, just incorrect results.
Please help.
Regards.Hi A_Non.
Thanks a lot, I tried with this:
SELECT
t.id,
x.dat,
y.seqno,
y.id_real
FROM
xml_test t,
XMLTABLE
'/msg/data/fields'
passing t.xml
columns
dat VARCHAR2(10) path 'dat',
id XMLTYPE path 'id'
)x,
XMLTABLE
'id'
passing x.id
columns
seqno FOR ORDINALITY,
id_real VARCHAR2(30) PATH '.'
)(+) y ;And is giving me the complete output.
Thanks again.
Regards. -
Error while working with XmlType in ADF..
Dear All,
I have a table like this.
ENTRIES
SRNO NUMBER not null,
XMLCONTENT CLOB,
SUBJECT VARCHAR2(100) not null,
DESCRIPTION VARCHAR2(500),
XML_CONTENT XMLTYPE
.. for this i have created a simple am,vo and eo, for just checking crud operations with xmltype.
While testing(running am) i noticed following.
1> when xml_content(xmltype) is fetched by oracle busniess component browser it gets displayed as oracle.sql.OPAQUE@4e904 for each row.....?
i cannot see the xml data.......
2> when i try to update any record it gives me following exception.
(oracle.jbo.AlreadyLockedException) JBO-26030: Failed to lock the record, another user holds the lock.
3> when i try to insert record it gives me following exception.
(oracle.jbo.AlreadyLockedException) JBO-26030: Failed to lock the record, another user holds the lock.
Please can any one tell me how to work with xmltype as a column in adf..Is there any way to work with this type of problem.
Regards,
Santosh.
Component Version
========= =======
ADF Business Components 11.1.1.59.23
Java(TM) Platform 1.6.0_21
Oracle IDE 11.1.1.4.37.59.23
Versioning Support 11.1.1.4.37.59.23
Edited by: Santosh Vaza on Mar 14, 2011 6:11 PMThere is no explicit support for XMLType in ADF.
{thread:id=824323}
{thread:id=1101962} -
JDBC insert with XMLTYPE data type
Hi,
SOAP to JDBC scenario. Oracle 11G as a receiver.
Requirement is to insert whole xml payload message in one of Oracle table fields as a xml string. Target oracle DB table column is defined with XMLTYPE data type, it has capacity to hold xml data more than 4GB. I am using graphical mapping with direct INSERT statement.
When I try to insert xml payload with smaller size transaction goes through. However when the xml payload size increases it is giving following error in JDBC receiver communication channel monitoring.
Could not execute statement for table/stored proc. "TABLE_NAME" (structure "StructName") due to java.sql.SQLException: ORA-01704: string literal too long
Here is insert statement as in communication channel monitoring. (Note: XML payload with bold characters is truncated)
INSERT INTO TABLE_NAME (REQ_ID, OUTAGE_OBJ, TIMESTAMP, PROCESSED_FLAG) VALUES (VAL1, <?xml version="1.0" encoding="UTF-8"?>............</>, TO_DATE(2010-11-15 10:21:52,YYYY-MM-DD HH24:MI:SS), N)
Any suggestions to handle this requirement?
Thank you in advance.
Anand More.Hi Anand,
The problem here is definitely the length of the SQL query. i.e "INSERT INTO ......... VALUES......."
This is what i got when i searched for this ORACLE error code:
ORA-01704: string literal too long
Cause: The string literal is longer than 4000 characters.
Action: Use a string literal of at most 4000 characters. Longer values may only be entered using bind variables.
Please ask a ORACLE DB expert on how to handle this Also i am not sure how can we handle Bind Varibales in SAP PI.
I hope this helps.
Regards, Gaurav. -
Problem with a query with a BLOB data type
Hi i've a problem with this query in 11g. R1
SELECT
LOGTIMESTAMP,
LOGTIMEMILLIS,
MSGID,
XMLTYPE(MESSAGEBODY, nls_charset_id('AL32UTF8')).getClobVal() as LLamada
FROM
vordel.AUDIT_MESSAGE_PAYLOAD,
vordel.AUDIT_LOG_POINTS
WHERE
AUDIT_LOG_POINTS.LOGPOINTSPK = AUDIT_MESSAGE_PAYLOAD.MP_LOGPOINTSPK AND
LOGTIMESTAMP between TO_TIMESTAMP('03-12-2011 00:00','DD-MM-YYYY HH24:MI') and TO_TIMESTAMP('03-12-2011 12:00','DD-MM-YYYY HH24:MI')
and filtertype = 'LogMessagePayloadFilter'
and filtername like 'Log Llamada%'MESSAGEBODY: data type of the Column is BLOB
throw this error after execute the query
Error:
ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00200: could not convert from encoding UTF-8 to UCS2
Error at line 1
ORA-06512: at "SYS.XMLTYPE", line 283
ORA-06512: at line 1Could you check the BLOB really contains UTF-8 encoded XML?
What's your database character set?The BLOB contains UTF-8 Encoded
and the database where i am connectes have AL32UTF8 character set, but my internal instance have "AMERICAN_AMERICA.WE8ISO8859P1"
that is a problem?
How could I change the character set of the oracle local client to the character set of the remote oracle data base? -
Reading Advance Queuing with XMLType payload and JDBC Driver character encoding
Hi
I've got a problem retrieving the message from the queue with XMLType payload in Java.
It was working fine in 10g database but after the switch to 11g it returns corrupted string instead of real XML message. Database NLS_LANG setting is AL32UTF8
It is said that JDBC driver should deal with that automatically but it obviously don't in this case. When I dequeue the message using database functionality (DBMS_AQ package) it looks fine but not when using JDBC driver so Ithink it is character encoding issue or so. The message itself is enqueued by the database and supposed to be retrieved by dedicated EJB.
Driver file used: ojdbc6.jar
Additional libraries: aqapi.jar, xdb.jar
All file taken from 11g database installation.
What shoul dI do to get the xml message correctly?Do you mean NLS_LANG is AL32UTF8 or the database character set is AL32UTF8? What is the database character set (SELECT value FROM nls_database_parameters WHERE parameter='NLS_CHARACTERSET')?
Thanks,
Sergiusz -
I have defined a view to get the data from an XMLTYPE table into relational form. I have a problem with opening this view with ADO and Delphi 6.
If I define my view like this:
CREATE OR REPLACE VIEW xml_test (versionsnr)
AS SELECT extractValue(value(xml),'/STANDAT/HEADER/@versionsnr')
FROM xmltable xml
I will the an error ORA-03114 when I try to select from the view with ADO. I have no problems when doing the select in sql*plus.
When I define the view like this:
CREATE OR REPLACE VIEW xml_test2 (versionsnr)
AS SELECT extractValue(value(header),'/HEADER/@versionsnr')
FROM xmltable xml,
table(xmlsequence(extract(value(xml),'/STANDAT/HEADER'))) header
,then it works everywhere, but it is significally slower with large amounts of data.
Interestingly enough, if the view contains a minus operator like below, then it also works everywhere.
CREATE OR REPLACE VIEW xml_test3 (versionsnr)
AS
(SELECT extractValue(value(xml),'/STANDAT/HEADER/@versionsnr')
FROM xmltable xml
MINUS
SELECT extractValue(value(xml),'/STANDAT/HEADER/@versionsnr')
FROM xmltablenew xml)
Do you have any experience with this? Is it a bug in ADO?Viktor,
Have you looked in the Oracle server trace file dump location to see if there are any trace files that correspond with the time/date of your Ora-03114 error.
Secondly, Have you tried to trace your session to see what is happening? -
Problems with quotes when using processXSL...
Hi!
I need some help solving a problem with getting processXSL to output the quote (") character in a text file.
(Oracle Release 9.2.0.6.0)
CREATE TABLE tmp_lob(tmp_clob clob);
SET SCAN OFF
DECLARE
l_xml_doc dbms_xmldom.DOMDocument;
l_xsl_doc dbms_xmldom.DOMDocument;
l_file CLOB;
l_xsl_pro dbms_xslprocessor.Processor;
l_xsl dbms_xslprocessor.Stylesheet;
BEGIN
l_xsl_doc := dbms_xmldom.newDOMDocument(xmltype.createXML(
'<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" encoding="UTF-8"/>
<xsl:variable name="qt" select="'"'"/>
<xsl:template match="//WORD">
<xsl:value-of select="concat($qt,.,$qt)"/>
</xsl:template>
</xsl:stylesheet>')
l_xml_doc := dbms_xmldom.newDOMDocument(xmltype.createXML(
'<DOCUMENT>
<WORD>Hello World</WORD>
</DOCUMENT>')
l_xsl := dbms_xslprocessor.newStylesheet(l_xsl_doc, null);
l_xsl_pro := dbms_xslprocessor.newProcessor;
dbms_xslprocessor.processXSL(l_xsl_pro, l_xsl, l_xml_doc, l_file);
dbms_xslprocessor.freeProcessor(l_xsl_pro);
INSERT INTO tmp_lob(tmp_clob)
VALUES (l_file);
COMMIT;
END;
SELECT * FROM tmp_lob;
TMP_CLOB
Hello World
Desired output is "Hello World" (with the quotes)!
FYI...
SELECT *
FROM nls_database_parameters
WHERE parameter LIKE '%CHARACTERSET%'
PARAMETER VALUE
NLS_CHARACTERSET WE8ISO8859P1
NLS_NCHAR_CHARACTERSET AL16UTF16
Can anyone help?
Thanks,
Nick
Message was edited by:
nbeerDoes this help...
SQL> set define off
SQL> select xmltransform(xmltype('<Foo><WORD>Hello World</WORD></Foo>'),xmltype('<xsl:stylesheet ver
sion="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
2 <xsl:output method="text" encoding="UTF-8"/>
3 <xsl:template match="//WORD">
4 <xsl:text>"</xsl:text><xsl:value-of select="."/><xsl:text>"</xsl:text>
5 </xsl:template>
6 </xsl:stylesheet>')) from dual
7 /
XMLTRANSFORM(XMLTYPE('<FOO><WORD>HELLOWORLD</WORD></FOO>'),XMLTYPE('<XSL:STYLESH
"Hello World"
SQL> set define off
SQL> select extractValue(xmltransform(xmltype('<Foo><WORD>Hello World</WORD></Foo>'),xmltype('<xsl:s
tylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
2 <xsl:output method="text" encoding="UTF-8"/>
3 <xsl:template match="//WORD">
4 <xsl:text>"</xsl:text><xsl:value-of select="."/><xsl:text>"</xsl:text>
5 </xsl:template>
6 </xsl:stylesheet>')),'/text()') from dual
7 /
EXTRACTVALUE(XMLTRANSFORM(XMLTYPE('<FOO><WORD>HELLOWORLD</WORD></FOO>'),XMLTYPE(
"Hello World"
SQL> -
Export/import table with XMLTYPE data_type and fine_grained policy
Hi friends!
I'm trying to export a table with XMLTYPE and faine-grained policy.
Source: HP-UX - Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
Target: Linux 2.6.18-238.el5 - Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
I do it thru exp/imp old utilities as mention in metalink ID 1318012.1.
One of the things that surprised me after exp/imp is that the number of objects increased:
Objects at Source:
exp \"/ as sysdba\" owner=xml log=xml file=xml.dmp
Type
Number of Objects
TYPE
431
TRIGGER
6
TABLE
17
PROCEDURE
2
LOB
120
INDEX
17
FUNCTION
1
On Target:
imp \"/ as sysdba\" file=xml.dmp fromuser=xml touser=xml log=xml.log
Type
Number of Objects
TYPE
431
TABLE
32
PROCEDURE
2
LOB
429
INDEX
478
FUNCTION
1
Why is this happening? Is it normal?
Other problem that I found is triggers are not imported, why!?!?
Thank you very much for your help!
JoséHi!
The new squema was created empty. If I run the following query:
select '10g', TABLE_NAME,COUNT(*)
from DBA_LOBS@DSN_HP
where OWNER='XML'
group by TABLE_NAME
union
select '11g', table_name,count(*)
from DBA_LOBS
where OWNER='XML'
group by TABLE_NAME
order by 2,1
As a result:
Version
Table_name
Total
10g
ACTION_TABLE
1
11g
ACTION_TABLE
1
10g
Document1767_TAB
14
11g
Document1767_TAB
13
10g
Document1852_TAB
14
11g
Document1852_TAB
13
10g
Document1941_TAB
16
11g
Document1941_TAB
15
10g
Document2016_TAB
14
11g
Document2016_TAB
13
10g
Document2087_TAB
13
11g
Document2087_TAB
12
10g
IBT_XML_RECIBIDOS
1
11g
IBT_XML_RECIBIDOS
1
10g
LINEITEM_TABLE
2
11g
LINEITEM_TABLE
2
10g
PURCHASEORDER
7
11g
PURCHASEORDER
7
10g
PurchaseOrder1145_TAB
9
11g
PurchaseOrder1145_TAB
7
10g
RICARDO
13
10g
RICARDO2
1
11g
RICARDO2
1
10g
RITNTFER
1
11g
RITNTFER
1
10g
RITNTFRE_08
13
11g
SYS_NT3+LEU6vbfGLgQ18DLgrURw==
69
11g
SYS_NT3+LEU6vffGLgQ18DLgrURw==
76
11g
SYS_NT3+LEU6vjfGLgQ18DLgrURw==
63
11g
SYS_NT3+LEU6vpfGLgQ18DLgrURw==
1
11g
SYS_NT3+LEU6vqfGLgQ18DLgrURw==
2
11g
SYS_NT3+LEU6vTfGLgQ18DLgrURw==
65
11g
SYS_NT3+LEU6vXfGLgQ18DLgrURw==
66
10g
TESTCLOB
1
11g
TESTCLOB
1
There are many new tables created...I suppose because the differences between versions...
Any ideas?
Thanks a lot!
José -
[9i] poor performance with XMLType.transform
Hello,
I've got a problem with the Oracle function XMLType.transform.
When I try to apply a XSL to a big XML, it is very very slow, and it evens consumes all the CPU, and other users are not able to work until the processing is complete...
So I was wondering if my XSL was corrupted, but it does not seem so, because when i apply it with Internet Explorer (by just double-clicking on the .xml), it is immediately applied. I've also even tried with oraxsl, and the processing is quick and good.
So, i tried to use XDB, but it does not work, maybe I should upgrade to a newer version of XDB?
Please find the ZIP file here :
http://perso.modulonet.fr/~tleoutre/Oracle/samples.zip
Please find in this file :
1) The XSL file k_xsl.xsl
2) The "big" XML file big_xml.xml
Here you can try to apply the XSL on the XML with Internet Explorer : processing is very quick...
3) The batch file transform.bat
Here you can launch it, it calls oraxsl, and produces a result very quickly...
4) The SQL file test_xsl_with_xmltype_transform.sql.
You can try to launch it... First, it applies the same XSL with a little XML, and it's OK... And then, it applies the XSL to the same big XML as in point 1), and then, it takes a lot of time and CPU...
5) The SQL file test_xsl_with_xdb_1.sql ...
On my server, it fails... So I tried to change the XSL in the next point :
6) The SQL file test_xsl_with_xdb_2.sql with a "cleaned" XSL...
And then, it fails with exactly the same problem as in :
TransformerConfigurationException (Unknown expression at EOF: *|/.)
Any help would be greatly appreciated!
Thank you!
P.S. : Sorry for my bad english, I'm a French man :-)This is what I see...
Your tests are measuring the wrong thing. You are measuring the time to create the sample documents, which is being done very innefficiently, as well
as the time take to do the transform.
Below is the correct way to get mesasurements for each task..
Here's what I see on a PIV 2.4Ghz with 10.2.0.2.0 and 2GB of RAM
Fragments SourceSize TargetSize createSource Parse Transform
50 28014 104550 00:00:00.04 00:00:00.04 00:00:00.12
100 55964 209100 00:00:00.03 00:00:00.05 00:00:00.23
500 279564 1045500 00:00:00.16 00:00:00.23 00:00:01.76
1000 559064 2091000 00:00:00.28 00:00:00.28 00:00:06.04
2000 1118064 4182000 00:00:00.34 00:00:00.42 00:00:24.43
5000 2795064 10455000 00:00:00.87 00:00:02.02 00:03:19.02I think this clearly shows the pattern.
Of course what this testing really shows is that you've clearly missed the point of performing XSLT transformation inside the database.
The idea behind database based transformation is to optimize XSLT processing by
(1), not having to parse the XML and build a DOM tree before commencing the XSLT processing. In this example this is not possible since the
XML is being created from a CLOB based XMLType, not a schema based XMLType.
(2) Leveraging the Lazily Loaded Virtual DOM when doing sparse transformation ( A Sparse transformation is one where there are large parts of the
source document that are not required to create the target document. Again in this case the XSL requires you to walk all the nodes to generate the
required output.
If is necessary to process all of the nodes in the source document to generate the entire output it probably makes more sense to use a midtier XSL engine.
Here's the code I used to generate the numbers in the above example
BTW in terms of BIG XML we've successully processed 12G documents with Schema Based Storage...So nothing you have hear comes any where our defintion of big.- 1 with Oracle 10g Express on Linux
Also, please remember that 9.2.0.1.0 is not a supported release for any XML DB related features.
SQL*Plus: Release 10.2.0.2.0 - Production on Fri Feb 10 07:44:59 2006
Copyright (c) 1982, 2005, Oracle. All Rights Reserved.
SQL> spool createDocument.log
SQL> --
SQL> connect &1/&2
Connected.
SQL> --
SQL> create or replace directory &1 as '&3'
2 /
old 1: create or replace directory &1 as '&3'
new 1: create or replace directory SCOTT as '/home/mdrake/bugs/xslTest'
Directory created.
SQL> drop table source_data_table
2 /
Table dropped.
SQL> create table source_data_table
2 (
3 fragCount number,
4 xml_text clob,
5 xml xmlType,
6 result clob
7 )
8 /
Table created.
SQL> create or replace procedure createDocument(fragmentCount number)
2 as
3 fragmentText clob :=
4 '<AFL LIGNUM="1999">
5 <mat>20000001683</mat>
6 <name>DOE</name>
7 <firstname>JOHN</firstname>
8 <name2>JACK</name2>
9 <SEX>MALE</SEX>
10 <birthday>1970-05-06</birthday>
11 <salary>5236</salary>
12 <code1>5</code1>
13 <code2>6</code2>
14 <code3>7</code3>
15 <date>2006-05-06</date>
16 <dsp>8.665</dsp>
17 <dsp_2000>455.45</dsp_2000>
18 <darr04>5.3</darr04>
19 <darvap04>6</darvap04>
20 <rcrr>8</rcrr>
21 <rcrvap>9</rcrvap>
22 <rcrvav>10</rcrvav>
23 <rinet>11.231</rinet>
24 <rmrr>12</rmrr>
25 <rmrvap>14</rmrvap>
26 <ro>15</ro>
27 <rr>189</rr>
28 <date2>2004-05-09</date2>
29 </AFL>';
30
31 xmlText CLOB;
32
33 begin
34 dbms_lob.createTemporary(xmlText,true,DBMS_LOB.CALL);
35 dbms_lob.write(xmlText,5,1,'<PRE>');
36 for i in 1..fragmentCount loop
37 dbms_lob.append(xmlText,fragmentText);
38 end loop;
39 dbms_lob.append(xmlText,xmlType('<STA><COD>TER</COD><MSG>Op?ation R?ssie</MSG></STA>').getClobVal());
40 dbms_lob.append(xmlText,'</PRE>');
41 insert into source_data_table (fragCount,xml_text) values (fragmentCount, xmlText);
42 commit;
43 dbms_lob.freeTemporary(xmlText);
44 end;
45 /
Procedure created.
SQL> show errors
No errors.
SQL> --
SQL> set timing on
SQL> --
SQL> call createDocument(50)
2 /
Call completed.
Elapsed: 00:00:00.04
SQL> call createDocument(100)
2 /
Call completed.
Elapsed: 00:00:00.03
SQL> call createDocument(500)
2 /
Call completed.
Elapsed: 00:00:00.16
SQL> call createDocument(1000)
2 /
Call completed.
Elapsed: 00:00:00.28
SQL> call createDocument(2000)
2 /
Call completed.
Elapsed: 00:00:00.34
SQL> call createDocument(5000)
2 /
Call completed.
Elapsed: 00:00:00.87
SQL> select fragCount dbms_lob.getLength(xmlText)
2 from sample_data_table
3 /
select fragCount dbms_lob.getLength(xmlText)
ERROR at line 1:
ORA-00923: FROM keyword not found where expected
Elapsed: 00:00:00.00
SQL> quit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL*Plus: Release 10.2.0.2.0 - Production on Fri Feb 10 07:45:01 2006
Copyright (c) 1982, 2005, Oracle. All Rights Reserved.
SQL> spool testcase_&3..log
SQL> --
SQL> connect &1/&2
Connected.
SQL> --
SQL> set timing on
SQL> --
SQL> update source_data_table
2 set xml = xmltype(xml_text)
3 where fragCount = &3
4 /
old 3: where fragCount = &3
new 3: where fragCount = 50
1 row updated.
Elapsed: 00:00:00.04
SQL> commit
2 /
Commit complete.
Elapsed: 00:00:00.01
SQL> update source_data_table
2 set result = xmltransform(xml,xmltype(bfilename(USER,'&4'),nls_charset_id('WE8ISO8859P1'))).getClobVal()
3 where fragCount = &3
4 /
old 2: set result = xmltransform(xml,xmltype(bfilename(USER,'&4'),nls_charset_id('WE8ISO8859P1'))).getClobVal()
new 2: set result = xmltransform(xml,xmltype(bfilename(USER,'k_xsl.xsl'),nls_charset_id('WE8ISO8859P1'))).getClobVal()
old 3: where fragCount = &3
new 3: where fragCount = 50
1 row updated.
Elapsed: 00:00:00.12
SQL> commit
2 /
Commit complete.
Elapsed: 00:00:00.01
SQL> select fragCount, dbms_lob.getLength(xml_text),dbms_lob.getLength(result)
2 from source_data_table
3 /
FRAGCOUNT DBMS_LOB.GETLENGTH(XML_TEXT) DBMS_LOB.GETLENGTH(RESULT)
50 28014 104550
100 55964
500 279564
1000 559064
2000 1118064
5000 2795064
6 rows selected.
Elapsed: 00:00:00.01
SQL> quit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL*Plus: Release 10.2.0.2.0 - Production on Fri Feb 10 07:45:02 2006
Copyright (c) 1982, 2005, Oracle. All Rights Reserved.
SQL> spool testcase_&3..log
SQL> --
SQL> connect &1/&2
Connected.
SQL> --
SQL> set timing on
SQL> --
SQL> update source_data_table
2 set xml = xmltype(xml_text)
3 where fragCount = &3
4 /
old 3: where fragCount = &3
new 3: where fragCount = 100
1 row updated.
Elapsed: 00:00:00.05
SQL> commit
2 /
Commit complete.
Elapsed: 00:00:00.01
SQL> update source_data_table
2 set result = xmltransform(xml,xmltype(bfilename(USER,'&4'),nls_charset_id('WE8ISO8859P1'))).getClobVal()
3 where fragCount = &3
4 /
old 2: set result = xmltransform(xml,xmltype(bfilename(USER,'&4'),nls_charset_id('WE8ISO8859P1'))).getClobVal()
new 2: set result = xmltransform(xml,xmltype(bfilename(USER,'k_xsl.xsl'),nls_charset_id('WE8ISO8859P1'))).getClobVal()
old 3: where fragCount = &3
new 3: where fragCount = 100
1 row updated.
Elapsed: 00:00:00.23
SQL> commit
2 /
Commit complete.
Elapsed: 00:00:00.03
SQL> select fragCount, dbms_lob.getLength(xml_text),dbms_lob.getLength(result)
2 from source_data_table
3 /
FRAGCOUNT DBMS_LOB.GETLENGTH(XML_TEXT) DBMS_LOB.GETLENGTH(RESULT)
50 28014 104550
100 55964 209100
500 279564
1000 559064
2000 1118064
5000 2795064
6 rows selected.
Elapsed: 00:00:00.01
SQL> quit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL*Plus: Release 10.2.0.2.0 - Production on Fri Feb 10 07:45:02 2006
Copyright (c) 1982, 2005, Oracle. All Rights Reserved.
SQL> spool testcase_&3..log
SQL> --
SQL> connect &1/&2
Connected.
SQL> --
SQL> set timing on
SQL> --
SQL> update source_data_table
2 set xml = xmltype(xml_text)
3 where fragCount = &3
4 /
old 3: where fragCount = &3
new 3: where fragCount = 500
1 row updated.
Elapsed: 00:00:00.12
SQL> commit
2 /
Commit complete.
Elapsed: 00:00:00.03
SQL> update source_data_table
2 set result = xmltransform(xml,xmltype(bfilename(USER,'&4'),nls_charset_id('WE8ISO8859P1'))).getClobVal()
3 where fragCount = &3
4 /
old 2: set result = xmltransform(xml,xmltype(bfilename(USER,'&4'),nls_charset_id('WE8ISO8859P1'))).getClobVal()
new 2: set result = xmltransform(xml,xmltype(bfilename(USER,'k_xsl.xsl'),nls_charset_id('WE8ISO8859P1'))).getClobVal()
old 3: where fragCount = &3
new 3: where fragCount = 500
1 row updated.
Elapsed: 00:00:01.76
SQL> commit
2 /
Commit complete.
Elapsed: 00:00:00.00
SQL> select fragCount, dbms_lob.getLength(xml_text),dbms_lob.getLength(result)
2 from source_data_table
3 /
FRAGCOUNT DBMS_LOB.GETLENGTH(XML_TEXT) DBMS_LOB.GETLENGTH(RESULT)
50 28014 104550
100 55964 209100
500 279564 1045500
1000 559064
2000 1118064
5000 2795064
6 rows selected.
Elapsed: 00:00:00.00
SQL> quit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL*Plus: Release 10.2.0.2.0 - Production on Fri Feb 10 07:45:04 2006
Copyright (c) 1982, 2005, Oracle. All Rights Reserved.
SQL> spool testcase_&3..log
SQL> --
SQL> connect &1/&2
Connected.
SQL> --
SQL> set timing on
SQL> --
SQL> update source_data_table
2 set xml = xmltype(xml_text)
3 where fragCount = &3
4 /
old 3: where fragCount = &3
new 3: where fragCount = 1000
1 row updated.
Elapsed: 00:00:00.28
SQL> commit
2 /
Commit complete.
Elapsed: 00:00:00.01
SQL> update source_data_table
2 set result = xmltransform(xml,xmltype(bfilename(USER,'&4'),nls_charset_id('WE8ISO8859P1'))).getClobVal()
3 where fragCount = &3
4 /
old 2: set result = xmltransform(xml,xmltype(bfilename(USER,'&4'),nls_charset_id('WE8ISO8859P1'))).getClobVal()
new 2: set result = xmltransform(xml,xmltype(bfilename(USER,'k_xsl.xsl'),nls_charset_id('WE8ISO8859P1'))).getClobVal()
old 3: where fragCount = &3
new 3: where fragCount = 1000
1 row updated.
Elapsed: 00:00:06.04
SQL> commit
2 /
Commit complete.
Elapsed: 00:00:00.00
SQL> select fragCount, dbms_lob.getLength(xml_text),dbms_lob.getLength(result)
2 from source_data_table
3 /
FRAGCOUNT DBMS_LOB.GETLENGTH(XML_TEXT) DBMS_LOB.GETLENGTH(RESULT)
50 28014 104550
100 55964 209100
500 279564 1045500
1000 559064 2091000
2000 1118064
5000 2795064
6 rows selected.
Elapsed: 00:00:00.00
SQL> quit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL*Plus: Release 10.2.0.2.0 - Production on Fri Feb 10 07:45:11 2006
Copyright (c) 1982, 2005, Oracle. All Rights Reserved.
SQL> spool testcase_&3..log
SQL> --
SQL> connect &1/&2
Connected.
SQL> --
SQL> set timing on
SQL> --
SQL> update source_data_table
2 set xml = xmltype(xml_text)
3 where fragCount = &3
4 /
old 3: where fragCount = &3
new 3: where fragCount = 2000
1 row updated.
Elapsed: 00:00:00.42
SQL> commit
2 /
Commit complete.
Elapsed: 00:00:00.02
SQL> update source_data_table
2 set result = xmltransform(xml,xmltype(bfilename(USER,'&4'),nls_charset_id('WE8ISO8859P1'))).getClobVal()
3 where fragCount = &3
4 /
old 2: set result = xmltransform(xml,xmltype(bfilename(USER,'&4'),nls_charset_id('WE8ISO8859P1'))).getClobVal()
new 2: set result = xmltransform(xml,xmltype(bfilename(USER,'k_xsl.xsl'),nls_charset_id('WE8ISO8859P1'))).getClobVal()
old 3: where fragCount = &3
new 3: where fragCount = 2000
1 row updated.
Elapsed: 00:00:24.43
SQL> commit
2 /
Commit complete.
Elapsed: 00:00:00.03
SQL> select fragCount, dbms_lob.getLength(xml_text),dbms_lob.getLength(result)
2 from source_data_table
3 /
FRAGCOUNT DBMS_LOB.GETLENGTH(XML_TEXT) DBMS_LOB.GETLENGTH(RESULT)
50 28014 104550
100 55964 209100
500 279564 1045500
1000 559064 2091000
2000 1118064 4182000
5000 2795064
6 rows selected.
Elapsed: 00:00:00.00
SQL> quit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL*Plus: Release 10.2.0.2.0 - Production on Fri Feb 10 07:45:36 2006
Copyright (c) 1982, 2005, Oracle. All Rights Reserved.
SQL> spool testcase_&3..log
SQL> --
SQL> connect &1/&2
Connected.
SQL> --
SQL> set timing on
SQL> --
SQL> update source_data_table
2 set xml = xmltype(xml_text)
3 where fragCount = &3
4 /
old 3: where fragCount = &3
new 3: where fragCount = 5000
1 row updated.
Elapsed: 00:00:02.02
SQL> commit
2 /
Commit complete.
Elapsed: 00:00:00.05
SQL> update source_data_table
2 set result = xmltransform(xml,xmltype(bfilename(USER,'&4'),nls_charset_id('WE8ISO8859P1'))).getClobVal()
3 where fragCount = &3
4 /
old 2: set result = xmltransform(xml,xmltype(bfilename(USER,'&4'),nls_charset_id('WE8ISO8859P1'))).getClobVal()
new 2: set result = xmltransform(xml,xmltype(bfilename(USER,'k_xsl.xsl'),nls_charset_id('WE8ISO8859P1'))).getClobVal()
old 3: where fragCount = &3
new 3: where fragCount = 5000
1 row updated.
Elapsed: 00:03:19.02
SQL> commit
2 /
Commit complete.
Elapsed: 00:00:00.01
SQL> select fragCount, dbms_lob.getLength(xml_text),dbms_lob.getLength(result)
2 from source_data_table
3 /
FRAGCOUNT DBMS_LOB.GETLENGTH(XML_TEXT) DBMS_LOB.GETLENGTH(RESULT)
50 28014 104550
100 55964 209100
500 279564 1045500
1000 559064 2091000
2000 1118064 4182000
5000 2795064 10455000
6 rows selected.
Elapsed: 00:00:00.04
SQL> quit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options
bash-2.05b$ -
Problem with function XMLIsValid()
Hi,
I have insered an invalid XML document into an XMLType table with constraint XMLIsValid(..)
My question is: Does my XML Schema not work or is there a problem with validation against xsd:key, xsd:keyef definitions?
I have checked my XML Schema and my XML Doxument instance with XMLSpy (V4.x) and with Xerces. Both parsers detect the error.
If you have any clue, please send me a note ([email protected]) or post a reply.
Thank you.
Please have a look on my tests. My setup of the test scenario is like Chapter 3 in 'XML Database Developer's Guide - Oracle XML DB':
1.)
begin
dbms_xmlschema.registerSchema(
'http://www.trivadis.com/xsd/orderlist.xsd',
getDocument('orderlist.xsd'),
TRUE, TRUE, FALSE, FALSE
end;
File 'orderlist.xsd':
<?xml version='1.0'?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
<xsd:element name="Product">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ProdName" type="xsd:string" maxOccurs="3"/>
<xsd:element name="USPrice" type="xsd:decimal"/>
<xsd:element name="ReleaseDate" type="xsd:date" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="prodID" type="PartNumType" use="required"/>
</xsd:complexType>
</xsd:element>
<xsd:simpleType name="PartNumType">
<xsd:restriction base="xsd:string">
<xsd:pattern value="[0-9]{3}-[A-Z]{2}"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:element name="OrderList">
<xsd:complexType >
<xsd:sequence>
<xsd:element name="OrderItem" minOccurs="1" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Customer" type="xsd:nonNegativeInteger"/>
<xsd:element name="Quantity" type="xsd:nonNegativeInteger"/>
<xsd:element name="ProductRef" type="PartNumType"/>
</xsd:sequence>
<xsd:attribute name="orderID" type="xsd:integer" use="required"/>
</xsd:complexType>
</xsd:element>
<xsd:element ref="Product" minOccurs="1" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:key name="ProductPK">
<xsd:selector xpath="Product" />
<xsd:field xpath="@prodID" />
</xsd:key>
<xsd:keyref name="ProductFK" refer="ProductPK">
<xsd:selector xpath="OrderItem" />
<xsd:field xpath="ProductRef"/>
</xsd:keyref>
</xsd:element>
</xsd:schema>
2.)
CREATE TABLE XML_ORDERLIST of XMLType
XMLSCHEMA "http://www.trivadis.com/xsd/orderlist.xsd"
ELEMENT "OrderList";
3.)
ALTER TABLE XML_ORDERLIST
add constraint VALID_ORDERLIST
check (XMLIsValid(sys_nc_rowinfo$)=1);
btw: What is 'sys_nc_rowinfo$'?
4.) ERROR:
SQL> INSERT INTO XML_ORDERLIST values (xmltype(getDocument('orderlist2err.xml')));
1 row created.
File:
<?xml version='1.0' ?>
<OrderList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://www.trivadis.com/xsd/orderlist.xsd">
<OrderItem orderID="2">
<Customer>7934</Customer>
<Quantity>12</Quantity>
<ProductRef>125-AS</ProductRef>
</OrderItem>
<Product prodID="124-AS">
<ProdName>Playstation</ProdName>
<USPrice>56.78</USPrice>
<ReleaseDate>2001-12-24</ReleaseDate>
</Product>
</OrderList>
Comment:
This document is not valid because element <ProductRef> references an PK wich does not exist, but the document has been inserted!
The XML Schema defines an PK-FK restriction on elements: <Product prodID="124-AS"> and <ProductRef>125-AS</ProductRef>I tried something similar. It looks like Oracle does not use the xsd:key* info. If you enter the corersponding information (I used XMLSpy; if you do it by hand you'll want to look at http://www.grandpoohbah.net/Sandeepan/IOUG2001XDB.htm or similar helpful pages) as xdb:columnProps it seems to work as expected.
-
I am trying to implement some kind of a server listening for requests. The listener part of the app, is a daemon thread that listens for connections and instantiates a handling daemon thread once it gets some. However, my problem is that i must be able to kill the listening thread at the user's will (say via a sto button). I have done this via the Sun's proposed way, by testing a boolean flag in the loop, which is set to false when i wish to kill the thread. The problem with this thing is the following...
Once the thread starts excecuting, it will test the flag, find it true and enter the loop. At some point it will LOCK on the server socket waiting for connection. Unless some client actually connects, it will keep on listening indefinatelly whithought ever bothering to check for the flag again (no matter how many times you set the damn thing to false).
My question is this: Is there any real, non-theoretical, applied way to stop thread in java safely?
Thank you in advance,
LeftyThis was one solution from the socket programming forum, have you tried this??
public Thread MyThread extends Thread{
boolean active = true;
public void run(){
ss.setSoTimeout(90);
while (active){
try{
serverSocket = ss.accept();
catch (SocketTimeoutException ste){
// do nothing
// interrupt thread
public void deactivate(){
active = false;
// you gotta sleep for a time longer than the
// accept() timeout to make sure that timeout is finished.
try{
sleep(91);
}catch (InterruptedException ie){
interrupt();
} -
Problem with Threads and a static variable
I have a problem with the code below. I am yet to make sure that I understand the problem. Correct me if I am wrong please.
Code functionality:
A timer calls SetState every second. It sets the state and sets boolean variable "changed" to true. Then notifies a main process thread to check if the state changed to send a message.
The problem as far I understand is:
Assume the timer Thread calls SetState twice before the main process Thread runs. As a result, "changed" is set to true twice. However, since the main process is blocked twice during the two calls to SetState, when it runs it would have the two SetState timer threads blocked on its synchronized body. It will pass the first one, send the message and set "changed" to false since it was true. Now, it will pass the second thread, but here is the problem, "changed" is already set to false. As a result, it won't send the message even though it is supposed to.
Would you please let me know if my understanding is correct? If so, what would you propose to resolve the problem? Should I call wait some other or should I notify in a different way?
Thanks,
B.D.
Code:
private static volatile boolean bChanged = false;
private static Thread objMainProcess;
protected static void Init(){
objMainProcess = new Thread() {
public void run() {
while( objMainProcess == Thread.currentThread() ) {
GetState();
objMainProcess.setDaemon( true );
objMainProcess.start();
public static void initStatusTimer(){
if(objTimer == null)
objTimer = new javax.swing.Timer( 1000, new java.awt.event.ActionListener(){
public void actionPerformed( java.awt.event.ActionEvent evt){
SetState();
private static void SetState(){
if( objMainProcess == null ) return;
synchronized( objMainProcess ) {
bChanged = true;
try{
objMainProcess.notify();
}catch( IllegalMonitorStateException e ) {}
private static boolean GetState() {
if( objMainProcess == null ) return false;
synchronized( objMainProcess ) {
if( bChanged) {
SendMessage();
bChanged = false;
return true;
try {
objMainProcess.wait();
}catch( InterruptedException e ) {}
return false;
}Thanks DrClap for your reply. Everything you said is right. It is not easy to make them alternate since SetState() could be called from different places where the state could be anything else but a status message. Like a GREETING message for example. It is a handshaking message but not a status message.
Again as you said, There is a reason I can't call sendMessage() inside setState().
The only way I was able to do it is by having a counter of the number of notifies that have been called. Every time notify() is called a counter is incremented. Now instead of just checking if "changed" flag is true, I also check if notify counter is greater than zero. If both true, I send the message. If "changed" flag is false, I check again if the notify counter is greater than zero, I send the message. This way it works, but it is kind of a patch than a good design fix. I am yet to find a good solution.
Thanks,
B.D.
Maybe you are looking for
-
Problem related to the start of the application servers
Hello, I have a WebLogic 12c domain composed of an administration server, an soa/bpm managed server and an OSB managed server. They aren't clustered. In order to start the servers I'm using Node Manager. So, I thought to start the admin server and, a
-
I was recently trying to think of a good way to secure my root account the best way possible and came up with this idea. It works great for me so I thought I'd share. This method will involve three major users including the sudo program. First being
-
Cannot make a fresh install of Lion on my Macbook Pro.
Whenever I try to reinstall Lion through the Recovery HD menu, the installation goes fine up until a moment when it prompts me that if I would really like to cancel the installation procedure, even though I did not cancel it. I click to not cancel it
-
Hello, I am new to Application Express and am trying to create a database application. I signed up and requested a workspace and have been working totally online to create the application. I created a page and imported some images to Shared Component
-
Partial retirement or transfer of prior-yr acquis. not possible
Partial retirement or transfer of prior-yr acquis. not possible? How can I fix it? wht does it mean? thanq