Multilingual Problem in XMLTYPE

Hi Experts, 
My database as follows:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
NLS_CHARACTERSET WE8ISO8859P1
Im storing XML in one of the table in my database in XMLTYPE column. But when my XML node contains some multilingual value( Ex: Chinese) it is showing junk value. Is there any way to store as it is?
INSERT INTO web_xml_file  (file_no, web_file_data, record_status, user_created, created)   VALUES (v_file_no, xmltype.createxml(p_in_xml), 'UNP', USER, SYSDATE);
  FILE_NO       NUMBER,
  WEB_FILE_DATA XMLTYPE,
  RECORD_STATUS VARCHAR2(3),
  ERROR_MSG     VARCHAR2(4000),
  USER_CREATED  VARCHAR2(50),
  CREATED       DATE,
  USER_CHANGED  VARCHAR2(50),
  CHANGED       DATE

The following seems to work but be aware it's still a hack, and certainly not bulletproof.
The best way to handle this is to have the db charset migrated to AL32UTF8, or to do the parsing externally.
select utl_i18n.raw_to_nchar(utl_i18n.string_to_raw(skywardsnumber), 'AL32UTF8') as skywardsnumber
     , utl_i18n.raw_to_nchar(utl_i18n.string_to_raw(title), 'AL32UTF8') as title
     , utl_i18n.raw_to_nchar(utl_i18n.string_to_raw(firstname), 'AL32UTF8') as firstname
     , utl_i18n.raw_to_nchar(utl_i18n.string_to_raw(familyname), 'AL32UTF8') as familyname
from xmltable('/data/passengerinformation'
       passing xmltype(dbms_xslprocessor.read2clob('XML_DIR','multi.xml', nls_charset_id('CHAR_CS')))
       columns skywardsnumber  varchar2(100) path 'skywardsnumber'
             , title           varchar2(100) path 'title'
             , firstname       varchar2(100) path 'firstname'
             , familyname      varchar2(100) path 'familyname'
     ) x ;
Explanations :
1) I've put your sample XML in a file saved with UTF-8 encoding, and shipped it to a database directory (DOC_DIR).
2) I access the file as CLOB using DBMS_XSLPROCESSOR.read2clob, and (here's the trick) considering the file in the db charset (mine was WE8ISO8859P15). As a consequence, all multibyte characters are converted to single byte characters in the DB charset.
3) I use the XMLType constructor to build an XMLType instance out of the CLOB and parse it with XMLTABLE.
4) That gives me four columns that I then convert to byte sequences (utl_i18n.string_to_raw), and finally to NCHAR (utl_i18n.raw_to_nchar) by specifying the original encoding of the file.

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>;)

  • Unpredictable problem using XMLTYPE in Oracle 11g?

    We recently upgraded from Oracle 10g to Oracle 11g, which caused some of our stored procedures to start acting funny.
    Our database stores BLOBs containing XML data in a table. We then asynchronously convert these BLOBs into XMLTYPE objects, and use them to perform operations in our database. This logic started failing when we moved to 11g.
    Our original code looked like this:
    PROCEDURE submitTpfdd(shipmentDataId IN VARCHAR2) AS
         shipmentData XMLTYPE;
      csid INTEGER;
      shipmentName VARCHAR(128);
      gk_namespaces VARCHAR(1024) := 'xmlns:a="http://my.app/1.0.0.0"';
    BEGIN
      SELECT NLS_CHARSET_ID('UTF8') INTO csid FROM dual;
      SELECT XMLTYPE(tf.shipmentData, csid)
        INTO shipmentData
        FROM SHIPQ.SHIPMENT_FILE tf
        WHERE tf.shipment_id = shipmentDataId;
      shipmentName := shipmentData.extract('/a:Shipment/shipmentName/text()', gk_namespaces).getStringVal();
      ... (more logic)
    END submitTpfdd;When we switched to 11g, this code started frequently failing with an "unsupported character set" error. It happens about half the time, and it's unpredictable. It will sometimes pass and sometimes fail, even if the same BLOB is being read both times. I haven't been able to reproduce the error with any of XMLTYPE's other constructors.
    Has anybody encountered similar behavior with the XMLTYPE in 11g? Should I submit a tracker?

    I have created a SQL program which can be run independently to reproduce the problem.
    DECLARE namespaces constant VARCHAR2(1024) := 'xmlns:a="http://morton.com/"';
    CURSOR cursor0(reeves XMLTYPE) IS
    SELECT EXTRACT(VALUE(t), 'text()').getstringval() AS
    bullock
    FROM TABLE(xmlsequence(reeves.EXTRACT('/a:hopper', namespaces))) t;
    CURSOR cursor1(reeves XMLTYPE) IS
    SELECT EXTRACT(VALUE(t), 'text()').getstringval() AS
    bullock
    FROM TABLE(xmlsequence(reeves.EXTRACT('/a:hopper', namespaces))) t;
    CURSOR cursor2(reeves XMLTYPE) IS
    SELECT EXTRACT(VALUE(t), 'text()').getstringval() AS
    bullock
    FROM TABLE(xmlsequence(reeves.EXTRACT('/a:hopper', namespaces))) t;
    CURSOR cursor3(reeves XMLTYPE) IS
    SELECT EXTRACT(VALUE(t), 'text()').getstringval() AS
    bullock
    FROM TABLE(xmlsequence(reeves.EXTRACT('/a:hopper', namespaces))) t;
    CURSOR cursor4(reeves XMLTYPE) IS
    SELECT EXTRACT(VALUE(t), 'text()').getstringval() AS
    bullock
    FROM TABLE(xmlsequence(reeves.EXTRACT('/a:hopper', namespaces))) t;
    CURSOR cursor5(reeves XMLTYPE) IS
    SELECT EXTRACT(VALUE(t), 'text()').getstringval() AS
    bullock
    FROM TABLE(xmlsequence(reeves.EXTRACT('/a:hopper', namespaces))) t;
    CURSOR cursor6(reeves XMLTYPE) IS
    SELECT EXTRACT(VALUE(t), 'text()').getstringval() AS
    bullock
    FROM TABLE(xmlsequence(reeves.EXTRACT('/a:hopper', namespaces))) t;
    CURSOR cursor7(reeves XMLTYPE) IS
    SELECT EXTRACT(VALUE(t), 'text()').getstringval() AS
    bullock
    FROM TABLE(xmlsequence(reeves.EXTRACT('/a:hopper', namespaces))) t;
    CURSOR cursor8(reeves XMLTYPE) IS
    SELECT EXTRACT(VALUE(t), 'text()').getstringval() AS
    bullock
    FROM TABLE(xmlsequence(reeves.EXTRACT('/a:hopper', namespaces))) t;
    CURSOR cursor9(reeves XMLTYPE) IS
    SELECT EXTRACT(VALUE(t), 'text()').getstringval() AS
    bullock
    FROM TABLE(xmlsequence(reeves.EXTRACT('/a:hopper', namespaces))) t;
    xml_clob CLOB := empty_clob;
    xml_blob BLOB := empty_blob;
    xml_varchar VARCHAR2(4000);
    xml_xmltype XMLTYPE;
    warning INTEGER;
    dest_offset INTEGER := 1;
    src_offset INTEGER := 1;
    lang_context INTEGER := 0;
    char_set INTEGER := nls_charset_id('UTF8');
    BEGIN
      dbms_lob.createtemporary(xml_clob, TRUE);
      dbms_lob.createtemporary(xml_blob, TRUE);
      dbms_lob.OPEN(xml_clob, dbms_lob.lob_readwrite);
      dbms_lob.OPEN(xml_blob, dbms_lob.lob_readwrite);
      xml_varchar := '<a:hopper xmlns:a="http://morton.com"/>';
      dbms_lob.writeappend(xml_clob, length(xml_varchar), xml_varchar);
      dbms_lob.converttoblob(xml_blob, xml_clob, dbms_lob.lobmaxsize, dest_offset, src_offset, char_set, lang_context, warning);
      xml_xmltype := XMLTYPE(xml_blob, char_set);
      FOR daniels IN cursor0(xml_xmltype)
      LOOP
        CONTINUE;
      END LOOP;
      FOR daniels IN cursor1(xml_xmltype)
      LOOP
        CONTINUE;
      END LOOP;
      FOR daniels IN cursor2(xml_xmltype)
      LOOP
        CONTINUE;
      END LOOP;
      FOR daniels IN cursor3(xml_xmltype)
      LOOP
        CONTINUE;
      END LOOP;
      FOR daniels IN cursor4(xml_xmltype)
      LOOP
        CONTINUE;
      END LOOP;
      FOR daniels IN cursor5(xml_xmltype)
      LOOP
        CONTINUE;
      END LOOP;
      FOR daniels IN cursor6(xml_xmltype)
      LOOP
        CONTINUE;
      END LOOP;
      FOR daniels IN cursor7(xml_xmltype)
      LOOP
        CONTINUE;
      END LOOP;
      FOR daniels IN cursor8(xml_xmltype)
      LOOP
        CONTINUE;
      END LOOP;
      FOR daniels IN cursor9(xml_xmltype)
      LOOP
        CONTINUE;
      END LOOP;
    END;If someone else could run this program and verify that it acts unpredictably, that would be helpful. I have submitted a metalink tracker but the person who is working the tracker is not able to duplicate the same behavior.

  • 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 help

    Thanks 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"

  • 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).

  • A problem extracting xmltype parameter

    Hello
    I'm using oracle 11g and I'm trying to use a xmltype as an input parameter to a SP, here is my SP:
    create or replace PROCEDURE ABC
    ( FE_Param IN XMLType)
    AS
    BEGIN
    FOR i IN
    SELECT XMLTYPE.EXTRACT (VALUE (a),
    '/Root/FE_ID/text()').getstringval() AS FE_ID
    FROM TABLE
    (XMLSEQUENCE (FE_Param.EXTRACT
    ('/FEData/Root')
    ) ) a )
    LOOP
    INSERT INTO table1
    VALUES (i.FE_ID);
    END LOOP;
    The XML parameter looks like that:
    <?xml version='1.0' encoding='utf-8' ?>
    <FEData>
    <Root><FE_ID>900000031</FE_ID>
    <FE_ID>900000032</FE_ID><FE_ID>900000050</FE_ID></Root></FEData>

    WITH table1 AS
    (SELECT xmltype('<?xml version="1.0" encoding="utf-8" ?>
                     <FEData>
                      <Root>
                        <FE_ID>900000031</FE_ID>
                        <FE_ID>900000032</FE_ID>
                        <FE_ID>900000050</FE_ID>
                      </Root>
                     </FEData>'
    ) xmlcol FROM dual)
    SELECT ExtractValue(column_Value, '/FE_ID').getStringVal() AS "FE_ID"
      FROM table1 t1
         , TABLE(xmlsequence(EXTRACT(t1.xmlcol,'/FEData/Root/FE_ID'))) v;
    FE_ID                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
        900000031                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
        900000032                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
        900000050   
    WITH table1 AS
    (SELECT xmltype('<?xml version="1.0" encoding="utf-8" ?>
                     <FEData>
                      <Root>
                        <FE_ID>900000031</FE_ID>
                        <FE_ID>900000032</FE_ID>
                        <FE_ID>900000050</FE_ID>
                      </Root>
                     </FEData>'
    ) xmlcol FROM dual)
    SELECT CAST(ExtractValue(column_Value, '/FE_ID') as VARCHAR2(10)) AS "FE_ID"
      FROM table1 t1
         , TABLE(xmlsequence(EXTRACT(t1.xmlcol,'/FEData/Root/FE_ID'))) v;
    FE_ID     
    900000031 
    900000032 
    900000050       You should use XMLCAST by the way (something I don't have on my 10.2.x database). Also use the XMLTABLE format if your on Oracle 11g
    Edited by: Marco Gralike on Aug 22, 2011 5:57 PM

  • Problem converting XMLTYPE data into database rows.

    Can anyone help with this ?
    I�ve got an XML document like the following:
    <ROWSET><ROW>><NAME>John</NAME></ROW></ROWSET>
    I want to extract the �Name� element and insert it into a table that has one column:
    create table employee
    (empname varchar2(50));
    The following PL/SQL block does the job:
    begin
    insert into employee
    (empname)
    select extractvalue(value(xmltab),'/ROW/NAME')
    from table(xmlsequence(extract(xmltype('
    <ROWSET><ROW>><NAME>Cpty 1</NAME></ROW></ROWSET>')
    ,'/ROWSET/ROW'))) xmltab;
    commit;
    end;
    However, instead of having the XML string embedded in the actual SQL statement I would like to assign the XML string to a variable (of type XMLTYPE) and refer to the variable in the SQL statement i.e.
    declare
    v_xml xmltype;
    begin
    v_xml := xmltype(�<ROWSET><ROW>><NAME>John</NAME></ROW></ROWSET>�)
    insert into employee
    (empname)
    select extractvalue(value(xmltab),'/ROW/NAME')
    from table(xmlsequence(extract(v_xml,'/ROWSET/ROW'))) xmltab;
    commit;
    end;
    When I run this I get the following exception:
    ORA-22905 Cannot access rows from a non-nested table.
    I can�t understand why the first example works but the second example doesn�t. I want to get the second version working because eventually I want to put this code in a stored proc that excepts an xmltype parameter.
    Any help would be much appreciated.

    Hi
    Now I understand why you want to use an insert as select...
    The following PL/SQL code should work...
    declare
    v_xml xmltype;
    begin
    v_xml := xmltype('<ROWSET><ROW><NAME>John</NAME></ROW></ROWSET>');
    insert into employee (empname)
    select extractvalue(value(t),'/NAME')
    from table(cast(xmlsequence(extract(v_xml, '/ROWSET/ROW/NAME'))as xmlsequencetype)) t;
    commit;
    end;
    Chris

  • Multilingual problems

    Hello,
              I am trying to make following page work:
              <%@ page contentType="text/html; charset=SJIS" %>
              <% out.println("\u30ab\u30c6\u30b4\u30ea\u306e\u8aac\u660e"); %>
              (I tried also Big5, Shift_JIS with the same result)
              I DON'T set encoding on initArgs.*.jsp in weblogic.properties for this
              test.
              I run WL 5.1 with SP3 on Windows 2000. JDK 1.2.2
              I am getting following JSP parsing exception when I try to go to the
              page
              first time :
              Mon Jul 10 12:08:13 JST 2000:<E> <WebAppServletContext-CRM> Servlet
              failed
              with Exception weblogic.servlet.jsp.JspException: (line 1): multiple
              charsets defined for
              this page: started with charset='UTF8', current content-type specifies
              'SJIS'
              at weblogic.servlet.jsp.JspLexer.jspException(JspLexer.java:602)
              at weblogic.servlet.jsp.JspLexer.contentTypeDirective(JspLexer.java:729)
              at weblogic.servlet.jsp.JspLexer.mPAGE_DIRECTIVE_BODY(JspLexer.java,
              Compiled Code) at
              weblogic.servlet.jsp.JspLexer.mPAGE_DIRECTIVE(JspLexer.java, Compiled
              Code)
              at weblogic.servlet.jsp.JspLexer.mDIRECTIVE(JspLexer.java, Compiled Code
              The Parsing Error is also thrown back to my browser (IE 5).
              I've also tried to set encoding=SJIS on initArgs. When I remove "page"
              directive,
              the servlet code looks like this (attached is the complete file):
              JspFactory.getDefaultFactory().getPageContext(this, request,
              response, null, true, 8192, true);
              out = pageContext.getOut();
              ((weblogic.servlet.jsp.JspWriterImpl)out).setEncoding("UTF8");
              response.setHeader("Content-Type", "text/html; charset=UTF8");
              and the Exception is gone, but the output is still UTF8 as you can
              guess.
              I've tried to ask WL Japanese support (by virtue of paying twice for the
              WebLogic my
              company entitled to Japanese support only), and after two days of mail
              going
              back and forward I finally got very promising answer:
              >BEA Japan Support Center wrote:
              >And, I suggest that you should use Japanese Windows.
              >In japanese environment, we have no problem on encoding japanese (SJIS).
              Classic.
              Hope for the help
              Anatol
              * This code was automatically generated at 6:50:52 PM on Jul 12, 2000
              * by weblogic.servlet.jsp.Jsp2Java -- do not edit.
              package examples.jsp.tagext.sql;
              import java.io.*;
              import java.util.*;
              import javax.servlet.*;
              import javax.servlet.http.*;
              import javax.servlet.jsp.*;
              import javax.servlet.jsp.tagext.*;
              // User imports
              // built-in init parameters:
              // boolean _verbose -- wants debugging
              // Well-known variables:
              // JspWriter out -- to write to the browser
              // HttpServletRequest request -- the request object.
              // HttpServletResponse response -- the response object.
              // PageContext pageContext -- the page context for this JSP
              // HttpSession session -- the session object for the client (if any)
              // ServletContext application -- The servlet (application) context
              // ServletConfig config -- The ServletConfig for this JSP
              // Object page -- the instance of this page's implementation class (i.e., 'this')
              * This code was automatically generated at 6:50:52 PM on Jul 12, 2000
              * by weblogic.servlet.jsp.Jsp2Java -- do not edit.
              * Copyright (c) 2000 by BEA Systems, Inc. All Rights Reserved.
              public class charset
              extends
              weblogic.servlet.jsp.JspBase
              implements weblogic.servlet.jsp.StaleIndicator
              // StaleIndicator interface
              public boolean _isStale() {
              weblogic.servlet.internal.ServletContextImpl sci =(weblogic.servlet.internal.ServletContextImpl)(getServletConfig().getServletContext());
              java.io.File f = null;
              long lastModWhenBuilt = 0L;
              if (sci.isResourceStale("/charset.jsp", 963395299134L)) return true;
              return false;
              public void _jspService(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException
              // declare and set well-known variables:
              javax.servlet.ServletConfig config = getServletConfig();
              javax.servlet.ServletContext application = config.getServletContext();
              Object page = this;
              javax.servlet.jsp.JspWriter out;
              PageContext pageContext =
              JspFactory.getDefaultFactory().getPageContext(this, request, response, null, true, 8192, true);
              out = pageContext.getOut();
              ((weblogic.servlet.jsp.JspWriterImpl)out).setEncoding("UTF8");
              response.setHeader("Content-Type", "text/html; charset=UTF8");
              HttpSession session = request.getSession(true);
              try { // begin check exception try block
              out.print("\r\n\r\n");
              out.println("\u30ab\u30c6\u30b4\u30ea\u306e\u8aac\u660e"); //[ /charset.jsp; Line: 3]
              } catch (RuntimeException __ee) { // propagate runtime exception
              throw __ee;
              } catch (Exception __ee) {
              if(__ee instanceof IOException) throw (IOException)__ee; // propagate ioexception
              // wrap all others in ServletException
              if (__ee instanceof ServletException) throw (ServletException)__ee;
              throw new ServletException("Caught Exception on JSP: " + getClass().getName(), __ee);
              } // end exception handling block
              //before final close brace...
              

    I am happy to hear that it works for you. I still hope that
              somebody from BEA will step in and give concrete advice.
              Thanks,
              Anatol
              "Li Zhongling (Alex)" wrote:
              >
              > Hi,
              >
              > In my case, i do the same thing in <%@ page contentType="text/html; charset=gb2312" %>, but, in <% out.println(""); %>
              > I directly input Chinese, while not in Unicode format like you did (i mean \u30ab\u30cb).
              >
              > I works fine for me.
              >
              > Alex
              >
              > Anatol Filin wrote:
              >
              > > Hello,
              > >
              > > I am trying to make following page work:
              > >
              > > <%@ page contentType="text/html; charset=SJIS" %>
              > > <% out.println("\u30ab\u30c6\u30b4\u30ea\u306e\u8aac\u660e"); %>
              > >
              > > (I tried also Big5, Shift_JIS with the same result)
              > >
              > > I DON'T set encoding on initArgs.*.jsp in weblogic.properties for this
              > > test.
              > >
              > > I run WL 5.1 with SP3 on Windows 2000. JDK 1.2.2
              > >
              > > I am getting following JSP parsing exception when I try to go to the
              > > page
              > > first time :
              > >
              > > Mon Jul 10 12:08:13 JST 2000:<E> <WebAppServletContext-CRM> Servlet
              > > failed
              > > with Exception weblogic.servlet.jsp.JspException: (line 1): multiple
              > > charsets defined for
              > > this page: started with charset='UTF8', current content-type specifies
              > > 'SJIS'
              > > at weblogic.servlet.jsp.JspLexer.jspException(JspLexer.java:602)
              > > at weblogic.servlet.jsp.JspLexer.contentTypeDirective(JspLexer.java:729)
              > > at weblogic.servlet.jsp.JspLexer.mPAGE_DIRECTIVE_BODY(JspLexer.java,
              > > Compiled Code) at
              > > weblogic.servlet.jsp.JspLexer.mPAGE_DIRECTIVE(JspLexer.java, Compiled
              > > Code)
              > > at weblogic.servlet.jsp.JspLexer.mDIRECTIVE(JspLexer.java, Compiled Code
              > >
              > > The Parsing Error is also thrown back to my browser (IE 5).
              > >
              > > I've also tried to set encoding=SJIS on initArgs. When I remove "page"
              > > directive,
              > > the servlet code looks like this (attached is the complete file):
              > >
              > > JspFactory.getDefaultFactory().getPageContext(this, request,
              > > response, null, true, 8192, true);
              > >
              > >
              > > out = pageContext.getOut();
              > > ((weblogic.servlet.jsp.JspWriterImpl)out).setEncoding("UTF8");
              > > response.setHeader("Content-Type", "text/html; charset=UTF8");
              > >
              > >
              > > and the Exception is gone, but the output is still UTF8 as you can
              > > guess.
              > >
              > > I've tried to ask WL Japanese support (by virtue of paying twice for the
              > > WebLogic my
              > > company entitled to Japanese support only), and after two days of mail
              > > going
              > > back and forward I finally got very promising answer:
              > >
              > > >BEA Japan Support Center wrote:
              > > >And, I suggest that you should use Japanese Windows.
              > > >In japanese environment, we have no problem on encoding japanese (SJIS).
              > >
              > > Classic.
              > >
              > > Hope for the help
              > > Anatol
              > >
              > > ------------------------------------------------------------------------
              > > /*
              > > * This code was automatically generated at 6:50:52 PM on Jul 12, 2000
              > > * by weblogic.servlet.jsp.Jsp2Java -- do not edit.
              > >
              >
              > --
              >
              > Best Regards
              >
              > Li Zhongling (Alex)
              >
              > --
              > Carpe Diem, Seize the Day !!
              

  • XML Namespace problem in XMLType

    Hi,
    I am getting this error, if anyone has any information about it please let me know.
    extract() returns the following error when a reserverd xml namespace 'xml:lang' is used in the xml document. if the namespace is removed it dosent give error.
    If this is not an error, please let me know how to workaround it.
    Thanks,
    Divakar.
    ERROR at line 1:
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00233: namespace prefixes starting with "xml" are reserved
    Error at line 71
    ORA-06512: at "XDB.DBMS_XMLDOM", line 3508
    ORA-06512: at "XDB.DBMS_XMLDOM", line 3551
    ORA-06512: at "OPS$DTANJORE.CDR_CDISC_TOPIC3", line 44
    ORA-06512: at line 1

    Hi Vijaykumar,
    Thanks for your reply.
    But it is standard proxy structure, Is it fine to modify this ?
    & it is proxy, so we have to regenerate it in SRM also.
    is it fine ?
    Study SAP

  • Question: How to use XMLType in a CMP EJB???

    Hello, Together,
    I have a big problem using XMLType in a CMP EJB. I don't know, if somebody knows about it:
    I am trying to write a CMP EJB, which should be deployed under JBoss later. The problem here is, which java data type should I use to map a column of XMLType. I have tried to use it as a java.lang.Object, and also as a java.lang.String, it did not work properly.
    Can someone help me? Thanks a lot!

    Just pass the in the JSP/Servlet involved ServletContext through as a method or constructor parameter of that Java class.
    Semi-pseudo:protected doPost(req, res) {
        ServletContext servletContext = getServletContext();
        SomeJavaClass someJavaClass = new SomeJavaClass(servletContext);
        // or
        someJavaClass.doSomething(servletContext);
    }

  • XMLType inputstream on OCI client

    Hi all, I have a problem using XMLType.createXML in java to create a XMLType to use as parameter in a stored procedure using OCI client (it works with thin client).
    my environment (sorry if I missed something!):
    Oracle db 11.1 on server, Java 1.6 and OCI client 11.1 on Windows on client.
    In my Eclipse project I included the following jars:
    \jdbc\lib\ojdbc6.jar
    \jlib\orai18n.jar
    \RDBMS\jlib\xdb.jar
    \LIB\xmlparserv2.jar
    the java code snippet for calling the stored procedure using the input stream:
    public String putgetXMLInputStream(File testFile) throws SQLException, FileNotFoundException, UnsupportedEncodingException
         // create the input stream from the file containing XML
         InputStream br = new BufferedInputStream(new FileInputStream(testFile));      
    // this statement was tested with no value for "kind" parameter and with these two value too
         // "oracle.xml.parser.XMLDocument.THICK"
         // "oracle.xml.parser.XMLDocument.THIN"
         XMLType xmlDoc = XMLType.createXML(connection, br);
         // set the statement
         CallableStatement cs;
         cs = connection.prepareCall("{?=call MYPACKAGE.TESTUPLOAD(?)}");
    cs.registerOutParameter(1, OracleTypes.VARCHAR);           
         cs.setObject(2, xmlDoc);
    // execute the statement
         cs.execute();
         // return the string
         return cs.getString(1);
    same code with string:
    public String putgetXMLString(File testFile) throws SQLException, FileNotFoundException, UnsupportedEncodingException, IOException
         StringBuilder contents = new StringBuilder();
         try {
         //use buffering, reading one line at a time
         //FileReader always assumes default encoding is OK!
         BufferedReader input = new BufferedReader(new FileReader(aFile));
         try {
              String line = null; //not declared within while loop
              * readLine is a bit quirky :
              * it returns the content of a line MINUS the newline.
              * it returns null only for the END of the stream.
              * it returns an empty String if two newlines appear in a row.
              while (( line = input.readLine()) != null){
              contents.append(line);
              contents.append(System.getProperty("line.separator"));
         } finally {
         input.close();
         XMLType xmlDoc = XMLType.createXML(connection, contents.toString());      
         // set the statement
         CallableStatement cs;
         cs = connection.prepareCall("{?=call MYPACKAGE.TESTUPLOAD(?)}");
    cs.registerOutParameter(1, OracleTypes.VARCHAR);           
         cs.setObject(2, xmlDoc);
    // execute the statement
         cs.execute();
         // return the string
         return cs.getString(1);
    the java code snippet for establish the database connection (I know that with java 1.6 the registerDriver is not
    required, I both tested with and without driver registering and it works in the same way):
    // connection string: comment as required
    // connection string for thin client
    // String connectionString = "jdbc:oracle:thin:@mydbserver:1521:mydb";
    // connection string for oci
    String connectionString = "jdbc:oracle:oci8:@mydbserver:1521:mydb";
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    Connection conn =DriverManager.getConnection( connectionString, "john", "tiger");
    DatabaseMetaData meta = conn.getMetaData();
    System.out.println("Driver JDBC: " + meta.getDriverVersion());
    The PL/SQL called by java:
    FUNCTION TESTUPLOAD (pDoc IN XMLTYPE) RETURN VARCHAR2 IS
    msgout VARCHAR2(24000);
    doc DBMS_XMLDOM.DOMDocument;
    rootnode DBMS_XMLDOM.DOMNode;
    fchild DBMS_XMLDOM.DOMNode;
    attr1 VARCHAR2(20);
    ns VARCHAR2(200);
    BEGIN
    ns := 'xmlns="http://www.myweb.it/static/xml/def/0.6/ns1.html" xmlns:si="http://www.myweb.it/static/xml/def/0.6/si.html"';
    doc := DBMS_XMLDOM.newDOMDocument(pDoc);
    rootnode := dbms_xmldom.makeNode(doc);
    fchild := DBMS_XMLDOM.GETFIRSTCHILD(rootnode);
    -- dom text
    DBMS_XMLDOM.WRITETOBUFFER(rootnode, msgout);
    -- attribute value
    dbms_xslprocessor.valueOf(rootnode,'/DOC/@TYPENO',attr1, ns );
    -- node name of rootnode first child
    return '(' || attr2 || ' - ' || DBMS_XMLDOM.GETNODENAME(fchild) || ') ' || msgout;
    END TESTUPLOAD;
    Thus, the expected result is a returned varchar2 containing the value of the attribute as per XPath, the name of first child node
    and the whole text of dom.
    This work as expected connecting via OCI and Thin client if I create the XML starting from a string, and only with Thin client if
    I adopt the input stream approach. If I use the input stream with OCI client, no error message is displayed, and no value are provided
    for attribute or fchild name, but the dom text is returned.
    I made test with different charset encoding for the original file (UTF-8, ISO-8859-1, with endofline in windows and linux style).
    What I noticed is that in case of string and input stream with Thin client some kind of parsing occours: the returned text show some
    special characters (i.e. double quote) replaced by html entity and the charset encoding in <?xml tag replaced with ISO-8859-1, more over
    the returned xml is well indented.
    I'm sure that I'm missing something :-)
    Any hints?
    TIA
    GB
    Edited by: user12844059 on 7-mag-2010 6.54

    visit the javasoft.com (sun site) for tutorials and training on all of the technologies you mentioned.
    after understanding them, then review the oracle java roadmap found on technet.oracle.com --> technologies --> java to get an oracle perspective.
    then ask the oracle technology specific questions you have.

  • Storing bigger xml records into XMLTYPE

    Hello Friends,
    We are trying to store XML records in Oracle 9i, using the 'XMLTYPE' object. We created the following table:
    SQL> desc mytable;
    Name Null? Type
    SOME_NBR NUMBER(9)
    MY_RECORD XMLTYPE
    We were able to store smaller records upto a certain size say around 2433 characters. Beyond this size, it is not accepting the records. The message given is:
    "ERROR:
    ORA-01756: quoted string not properly terminated"
    Could you please tell us how we can store bigger XML records into the XMLTYPE?

    Hi,
    I am facing problem with XMLType.getDOM().
    In my java program I am getting th error ...
    java.sql.SQLException: Bigger type length than Maximum0: oracle.xdb.XMLType.getDOM(XMLType.java:1524)
    Sample code is as follows...
    XMLType theXml = (XMLType) rs.getObject(2);
    Document accDOM = new DOMBuilder().build(theXml.getDOM());
    Please let me know what could be the resason for.
    Thanks in advance,
    -Jayaram.

  • XML Character Encoding Using UTL_DBWS

    Hi,
    I have a database with WINDOWS-1252 character encoding. I'm using UTL_DBWS to call a web service method which echoes a given string. For this purpose, I do the following:
    DECLARE
        v_wsdl CONSTANT VARCHAR2(500) := 'http://myhost/myservice?wsdl';
        v_namespace CONSTANT VARCHAR2(500) := 'my.namespace';
        v_service_name CONSTANT UTL_DBWS.QNAME := UTL_DBWS.to_qname(v_namespace, 'MyService');
        v_service_port CONSTANT UTL_DBWS.QNAME := UTL_DBWS.to_qname(v_namespace, 'MySoapServicePort');
        v_ping CONSTANT UTL_DBWS.QNAME := UTL_DBWS.to_qname(v_namespace, 'ping');
        v_wsdl_uri CONSTANT URITYPE := URIFACTORY.getURI(v_wsdl);
        v_str_request CONSTANT VARCHAR2(4000) :=
    '<?xml version="1.0" encoding="UTF-8" ?>
    <ping>
        <pingRequest>
            <echoData>Dev Team üöäß</echoData>
        </pingRequest>
    </ping>';
        v_service UTL_DBWS.SERVICE;
        v_call UTL_DBWS.CALL;
        v_request XMLTYPE := XMLTYPE (v_str_request);
        v_response SYS.XMLTYPE;
    BEGIN
        DBMS_JAVA.set_output(20000);
        UTL_DBWS.set_logger_level('FINE');
        v_service := UTL_DBWS.create_service(v_wsdl_uri, v_service_name);
        v_call := UTL_DBWS.create_call(v_service, v_service_port, v_ping);
        UTL_DBWS.set_property(v_call, 'oracle.webservices.charsetEncoding', 'UTF-8');
        v_response := UTL_DBWS.invoke(v_call, v_request);
        DBMS_OUTPUT.put_line(v_response.getStringVal());
        UTL_DBWS.release_call(v_call);
        UTL_DBWS.release_all_services;
    END;
    /Here is the SERVER OUTPUT:
    ServiceFacotory: oracle.j2ee.ws.client.ServiceFactoryImpl@a9deba8d
    WSDL: http://myhost/myservice?wsdl
    Service: oracle.j2ee.ws.client.dii.ConfiguredService@c881d39e
    *** Created service: -2121202561 - oracle.jpub.runtime.dbws.DbwsProxy$ServiceProxy@afb58220 ***
    ServiceProxy.get(-2121202561) = oracle.jpub.runtime.dbws.DbwsProxy$ServiceProxy@afb58220
    Collection Call info: port={my.namespace}MySoapServicePort, operation={my.namespace}ping, returnType={my.namespace}PingResponse, params count=1
    setProperty(oracle.webservices.charsetEncoding, UTF-8)
    dbwsproxy.add.map: ns, my.namespace
    Attribute 0: my.namespace: xmlns:ns, my.namespace
    dbwsproxy.lookup.map: ns, my.namespace
    createElement(ns:ping,null,my.namespace)
    dbwsproxy.add.soap.element.namespace: ns, my.namespace
    Attribute 0: my.namespace: xmlns:ns, my.namespace
    dbwsproxy.element.node.child.3: 1, null
    createElement(echoData,null,null)
    dbwsproxy.text.node.child.0: 3, Dev Team üöäß
    request:
    <ns:ping xmlns:ns="my.namespace">
       <pingRequest>
          <echoData>Dev Team üöäß</echoData>
       </pingRequest>
    </ns:ping>
    Jul 8, 2008 6:58:49 PM oracle.j2ee.ws.client.StreamingSender _sendImpl
    FINE: StreamingSender.response:<?xml version = '1.0' encoding = 'UTF-8'?>
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Header/><env:Body><ns0:pingResponse xmlns:ns0="my.namespace"><pingResponse><responseTimeMillis>0</responseTimeMillis><resultCode>0</resultCode><echoData>Dev Team üöäß</echoData></pingResponse></ns0:pingResponse></env:Body></env:Envelope>
    response:
    <ns0:pingResponse xmlns:ns0="my.namespace">
       <pingResponse>
          <responseTimeMillis>0</responseTimeMillis>
          <resultCode>0</resultCode>
          <echoData>Dev Team üöäß</echoData>
       </pingResponse>
    </ns0:pingResponse>As you can see the character encoding is broken in the request and in the response, i.e. the SOAP encoder does not take into consideration the UTF-8 encoding.
    I tracked down the problem to the method oracle.jpub.runtime.dbws.DbwsProxy.dom2SOAP(org.w3c.dom.Node, java.util.Hashtable); and more specifically to the calls of oracle.j2ee.ws.saaj.soap.soap11.SOAPFactory11.
    My question is: is there a way to make the SOAP encoder use the correct character encoding?
    Thanks a lot in advance!
    Greetings,
    Dimitar

    I found a workaround of the problem:
        v_response := XMLType(v_response.getBlobVal(NLS_CHARSET_ID('CHAR_CS')), NLS_CHARSET_ID('AL32UTF8'));Ugly, but I'm tired of decompiling and debugging Java classes ;)
    Greetings,
    Dimitar

  • Imported DocBook stylesheet location for XSQL Page

    Hi all,
    I've got the following XSQL page which queries a DocBook document stored in XMLDB as a schema-based CLOB.
    <?xml version = '1.0' encoding = 'UTF-8'?>
    <!--
    | Uncomment the following processing instruction and replace
    | the stylesheet name to transform output of your XSQL Page using XSLT
    <?xml-stylesheet type="text/xsl" href="YourStylesheet.xsl" ?>
    -->
    <page xmlns:xsql="urn:oracle-xsql" connection="jdbc/DBConnection1DS">
    <xsql:query max-rows="1" null-indicator="yes" tag-case="lower">
    SELECT extractValue(x.DOCBOOKS_DOC, '/book/part/title', 'xmlns="http://docbook.org/ns/docbook"') "BOOK_TITLE",
    extract(x.DOCBOOKS_DOC, '/book/part/chapter/sect1/sect2', 'xmlns="http://docbook.org/ns/docbook"').getStringVal() "BOOK_CONTENT"
    FROM DOCBOOKS_STORE x</xsql:query>
    </page>
    Which outputs the following:
    <!--
    | Uncomment the following processing instruction and replace
    | the stylesheet name to transform output of your XSQL Page using XSLT
    <?xml-stylesheet type="text/xsl" href="YourStylesheet.xsl" ?>
    -->
         <page>
         <rowset>
         <row num="1">
    <book_title>
    This is a test string
    </book_title>
         <book_content>
    <sect2 xmlns="http://docbook.org/ns/docbook"><title>
    This is sect2/title test text.
    </title><para>
    This is sect2/para test text.
    </para></sect2>
    </book_content>
    </row>
    </rowset>
    </page>
    The query runs fine (thanks to help from the XML DB forum). I'm now trying to use the docbook.xsl HTML stylesheet but I'm not sure of the following:
    1) Where do imported stylesheets need to be stored for the XLST processor to find them and can we change the default location (DocBooks has loads of associated stylesheet includes)? I've tried several locations and corresponding hrefs but nothing seems to work.
    2) Since the output contains a mixture of both DocBook and non-DocBook tags, I'm guessing/hoping that the XLST processor can parse the string extract and all what I would need to do is use is the <xsl:import/> and <xsl:apply-import/>. Is this correct?
    Many thanks in advance.
    George.

    Just closing the loop on this one...
    1) After more trial and error, I found that the XLST stylesheet need to be in the same location as the *.xsql page. To check, I wrote a simple XLST to output HTML rather than confuse the issue with applying the docbook imported stylesheets. This worked as expected with the resulting HTML output, bar the fact that I now have a security issue with my stylesheet sitting in the /PUBLIC_HTML folder. For the moment this is OK since the application is for internal prototyping purposes.
    2) If I want the XLST processor to parse the underlying XML tags, then the data needs to be returned as XMLType and not a VARCHAR2 string which my <xsl:query extract().getStringVal())> does.
    Unfortunately I now have an enviromental problem retrieving XMLType data through my XSQL query. I believe this has something to do with my JDBC driver and/or missing libraries.
    Cheers

  • Field Header displayed in Foreign Language while reteriving records.

    Hi all,
    I am facing MultiLingual problem when i reterieve the main table records,The field Code /Header is displayed in one Foreign Language like (French/german). the need is to display the Field Code/Header in English. what modification i need to put in code if i need to display the Header in english.
    The problem
    Approve        Posicio&#769;n de cata&#769;logo       GUID Client Code       Proveedor   Nu&#769;mero de contrato         Pai&#769;s de utilizacio&#769;n          Identificacio&#769;n del proveedor ............
    something like this for the Field header, but the record values are displaying as English.
    i am using com.sap.mdm  JAVA API, and the new patch 5.5.42.65
    what will be the reason and how to rectify it?
    With Thanks,
    Mary Joseph

    Hi,
      This happened to me also. What happens in display mode PARVW shows one value but when u double click on the record it shows the original value. This is the value that is stored internally in table. Use this value in ur select query.
    Regards,
    Raghavendra.

Maybe you are looking for

  • How do I get my NX6600GT-TD128E (PCIE) video card installed on a K8N NEO4-F Mb ?

    I have received two new NX6600GT-TD128E (MS-8983) vdeo cards to install on my new K8N NEO4-F (MS-7125) motherboard flashed with BIOS ver 1.B. First video card turned out to be bad.  The replacement card allows view of bios screens and post screen, bu

  • Export to Flash CS3 doesn't work

    Hello, I have Captivate 4 and Flash CS3 (full versions) - WinXP. When I want export Captivate project to Flash - "File -> Export -> Project to -> Flash CS3" I will get only notify: "Cannot initialize Cpativate FLA Exporter. You may need to restart Fl

  • Quality Inspection before Production

    Hi All, We are using Production resource tools(PRT) in Production Order. We want to do the quality inspection of the PRT before one day of Production. How can we map the following scenario so that Quality check can be done for PRT before Production??

  • Inbound function module idoc_input_mbgmcr

    Is there an inbound function module idoc_input_mbgmcr in existence somewhere that i can use?

  • Error 10 message on USB dev

    I'm getting an error message 0 when I attempt to get my CD to find an upgrade to the USB to fix the problem of the computer's failure to recofnize the presence of my player. When looking at the device manager, the usb for the zen player shows an excl