predicates on xmltype column nodes

Hello
Here, I'll send 2 files with table. What I need is the value of element < sno > who < name > is Tamil or Ravi and keyid = 111 record
In other words I'm looking for output is 102888 (102 is Tamil sno and 888 for happy).

with a (too)
SELECT ("< class > xmltype
< student >
< name > Raju < / name >
< sno > 101 < / sno >
< / student >
< student >
< name > Tamil < / name >
< > 102 sno < / sno >
< / student >
< student >
Delighted to < name > < / name >
< > 888 sno < / sno >
< / student >
(< / class > ') performance(1), keyid ' 111'
OF the double
Union of all the
SELECT ("< class > xmltype
< student >
< name > Tamil < / name >
< > 108 sno < / sno >
< / student >
< student >
< name > Alex < / name >
< sno > 208 < / sno >
< / student >
(< / class > ') performance(1), '222' keyid FROM dual
) A.keyid, a.result1 SELECTION of a


Thank you
Ravi

Hello

Do you really need concatenated values, or you are really looking for separate lines?

Assuming a version:

SQL> with a as (
  2  SELECT xmltype('
  3  
  4  Raju
  5  101
  6  
  7  
  8  Tamil
  9  102
 10  
 11  
 12  Ravi
 13  888
 14  
 15  ') result1,'111' keyid
 16  FROM dual
 17  union all
 18  SELECT xmltype('
 19  
 20  Tamil
 21  108
 22  
 23  
 24  Alex
 25  208
 26  
 27  ') result1,'222' keyid FROM dual
 28  )
 29  select xmlcast(
 30           xmlquery('/class/student[name="Tamil" or name="Ravi"]/sno'
 31                    passing a.result1
 32                    returning content)
 33           as varchar2(30)
 34         )
 35  from a
 36  where keyid = '111'
 37  ;

XMLCAST(XMLQUERY('/CLASS/STUDE
------------------------------
102888
 

Tags: Oracle Development

Similar Questions

  • Create indexes for an XMLType column.

    Hello

    I have a table that has a column of XMLType, the XSD is saved in DB. The XML is something like -

    < primary >
    < sub1 >
    < child1_1 / >
    < child1_2 / >
    < child1_3 / >
    < / sub1 >
    < sub2 >
    < child2_1 / >
    < child2_2 / >
    < child2_3 / >
    < / sub2 >
    < sub3 >
    < child31_1 / >
    < child3_2 / >
    < child3_3 / >
    < / sub3 >
    < / elementary school >

    I want to create indexes for child nodes. I read THAT XML structure cannot have collection as index it should be singleton.
    So can someone tell me no work around to create indexes for these nodes, or whatever it is that I missed as follows.

    Thank you

    #1. Since you're on 11g stop using the syntax of depricated... (extractValue, table (xmlsequence))

    SQL> create table PURCHASEORDER_TAB
      2  (
      3    PID number(4),
      4    PURCHASEORDER XMLTYPE
      5  )
      6  xmltype column PURCHASEORDER
      7  store as OBJECT RELATIONAL
      8  XMLSCHEMA "http://localhost:80/publishedContent/SB-XML/xsd/2010/purchaseOrder.xsd" Element "PurchaseOrder"
      9  /
    
    Table created.
    
    SQL> select table_name, table_type_name
      2  from user_nested_tables where parent_table_name = 'PURCHASEORDER_TAB';
    
    TABLE_NAME                     TABLE_TYPE_NAME
    ------------------------------ ------------------------------
    SYS_NTdmDOdAAMQsuXdRy6lc0H/A== Action64442_COLL
    SYS_NT8EIzAbUOQFGN2u6hCXP39g== LineItem64443_COLL
    
    SQL> rename "SYS_NT8EIzAbUOQFGN2u6hCXP39g==" to LINEITEM_NT
      2  /
    
    Table renamed.
    
    SQL> create index QTY_INDEX on LINEITEM_NT ("Quantity");
    
    Index created.
    
    SQL> set autotrace on explain lines 250 pages 50 trimspool on
    SQL> --
    SQL> select t.pid, quantity
      2    from PURCHASEORDER_TAB t,
      3         XMLTABLE
      4         (
      5           '/PurchaseOrder/LineItems/LineItem'
      6           passing t.PURCHASEORDER
      7           columns
      8           QUANTITY number(4) path 'Quantity'
      9         )
     10   where QUANTITY = 3
     11  /
    
    no rows selected
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 1929272390
    
    --------------------------------------------------------------------------------------------------
    | Id  | Operation                    | Name              | Rows  | Bytes | Cost (%CPU)| Time     |
    --------------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT             |                   |     1 |    46 |     3   (0)| 00:00:01 |
    |   1 |  NESTED LOOPS                |                   |       |       |            |          |
    |   2 |   NESTED LOOPS               |                   |     1 |    46 |     3   (0)| 00:00:01 |
    |*  3 |    TABLE ACCESS FULL         | LINEITEM_NT       |     1 |    23 |     2   (0)| 00:00:01 |
    |*  4 |    INDEX UNIQUE SCAN         | SYS_C00429284     |     1 |       |     0   (0)| 00:00:01 |
    |   5 |   TABLE ACCESS BY INDEX ROWID| PURCHASEORDER_TAB |     1 |    23 |     1   (0)| 00:00:01 |
    --------------------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       3 - filter(CAST(TO_NUMBER(TO_CHAR("Quantity")) AS number(4) )=3)
       4 - access("NESTED_TABLE_ID"="T"."SYS_NC0002900030$")
    
    Note
    -----
       - dynamic sampling used for this statement (level=2)
    
    SQL> select t.pid, quantity
      2    from PURCHASEORDER_TAB t,
      3         XMLTABLE
      4         (
      5           '/PurchaseOrder/LineItems/LineItem'
      6           passing t.PURCHASEORDER
      7           columns
      8           QUANTITY number(12,4) path 'Quantity'
      9         )
     10   where QUANTITY = 3
     11  /
    
    no rows selected
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 3093486066
    
    --------------------------------------------------------------------------------------------------
    | Id  | Operation                    | Name              | Rows  | Bytes | Cost (%CPU)| Time     |
    --------------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT             |                   |     1 |    46 |     2   (0)| 00:00:01 |
    |   1 |  NESTED LOOPS                |                   |       |       |            |          |
    |   2 |   NESTED LOOPS               |                   |     1 |    46 |     2   (0)| 00:00:01 |
    |   3 |    TABLE ACCESS FULL         | PURCHASEORDER_TAB |     1 |    23 |     2   (0)| 00:00:01 |
    |*  4 |    INDEX RANGE SCAN          | QTY_INDEX         |     1 |       |     0   (0)| 00:00:01 |
    |*  5 |   TABLE ACCESS BY INDEX ROWID| LINEITEM_NT       |     1 |    23 |     0   (0)| 00:00:01 |
    --------------------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       4 - access("Quantity"=3)
       5 - filter("NESTED_TABLE_ID"="T"."SYS_NC0002900030$")
    
    Note
    -----
       - dynamic sampling used for this statement (level=2)
    
    SQL> select t.pid, quantity
      2    from PURCHASEORDER_TAB t,
      3         XMLTABLE
      4         (
      5           '/PurchaseOrder/LineItems/LineItem'
      6           passing t.PURCHASEORDER
      7           columns
      8           QUANTITY path 'Quantity'
      9         )
     10   where QUANTITY = 3
     11  /
    
    no rows selected
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 3093486066
    
    --------------------------------------------------------------------------------------------------
    | Id  | Operation                    | Name              | Rows  | Bytes | Cost (%CPU)| Time     |
    --------------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT             |                   |     1 |    46 |     2   (0)| 00:00:01 |
    |   1 |  NESTED LOOPS                |                   |       |       |            |          |
    |   2 |   NESTED LOOPS               |                   |     1 |    46 |     2   (0)| 00:00:01 |
    |   3 |    TABLE ACCESS FULL         | PURCHASEORDER_TAB |     1 |    23 |     2   (0)| 00:00:01 |
    |*  4 |    INDEX RANGE SCAN          | QTY_INDEX         |     1 |       |     0   (0)| 00:00:01 |
    |*  5 |   TABLE ACCESS BY INDEX ROWID| LINEITEM_NT       |     1 |    23 |     0   (0)| 00:00:01 |
    --------------------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       4 - access("Quantity"=3)
       5 - filter("NESTED_TABLE_ID"="T"."SYS_NC0002900030$")
    
    Note
    -----
       - dynamic sampling used for this statement (level=2)
    
    SQL> SELECT t.pid, extractValue(Value(sta),'/LineItem/Quantity')
      2    FROM PURCHASEORDER_TAB t,
      3    table(xmlsequence(extract(t.purchaseOrder,'/PurchaseOrder/LineItems/LineItem'))) sta
      4    WHERE extractValue(Value(sta),'/LineItem/Quantity')= 3
      5  /
    
    no rows selected
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 3093486066
    
    --------------------------------------------------------------------------------------------------
    | Id  | Operation                    | Name              | Rows  | Bytes | Cost (%CPU)| Time     |
    --------------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT             |                   |     1 |    46 |     2   (0)| 00:00:01 |
    |   1 |  NESTED LOOPS                |                   |       |       |            |          |
    |   2 |   NESTED LOOPS               |                   |     1 |    46 |     2   (0)| 00:00:01 |
    |   3 |    TABLE ACCESS FULL         | PURCHASEORDER_TAB |     1 |    23 |     2   (0)| 00:00:01 |
    |*  4 |    INDEX RANGE SCAN          | QTY_INDEX         |     1 |       |     0   (0)| 00:00:01 |
    |*  5 |   TABLE ACCESS BY INDEX ROWID| LINEITEM_NT       |     1 |    23 |     0   (0)| 00:00:01 |
    --------------------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       4 - access("Quantity"=3)
       5 - filter("NESTED_TABLE_ID"="T"."SYS_NC0002900030$")
    
    Note
    -----
       - dynamic sampling used for this statement (level=2)
    
    SQL>
    

    Note the first example XMLTable does not use the index because the data type of AMOUNT is given wrong...

  • Extract data from complex XML of XMLType with nodes parents containing several internal nodes

    Hello

    I use Google geocoding XML Web Service to try to enrich some geo data in the database. I've kept all the Google result in an XMLType column, the result is something like this:

    <? XML version = "1.0" encoding = "UTF-8"? >

    < GeocodeResponse >

    < status > OK < / status >

    < result >

    Zip_code < type > < / type >

    < formatted_address > 76279, Saudi Arabia < / formatted_address >

    < address_component >

    < > 76279 long_name < / long_name >

    < > 76279 short_name < / short_name >

    Zip_code < type > < / type >

    < / address_component >

    < address_component >

    < long_name > Northern Frontier Province < / long_name >

    < short_name > Northern Frontier Province < / short_name >

    administrative_area_level_1 < type > < / type >

    < Type > policy < / type >

    < / address_component >

    < address_component >

    < long_name > Saudi Arabia < / long_name >

    < short_name > SA < / short_name >

    country of < type > < / type >

    < Type > policy < / type >

    < / address_component >

    < geometry >

    < location >

    < lat > 29.1214197 < / lat >

    < LNG > 44.3945656 < / LNG >

    < / location >

    < location_type > APPROX. < / location_type >

    < window >

    < Southwest >

    < lat > 29.1016132 < / lat >

    < LNG > 44.3654665 < / LNG >

    < / Southwest >

    < Northeast >

    < lat > 29.1400926 < / lat >

    < LNG > 44.4116001 < / LNG >

    < / Northeast >

    < / window >

    < limits >

    < Southwest >

    < lat > 29.1016132 < / lat >

    < LNG > 44.3654665 < / LNG >

    < / Southwest >

    < Northeast >

    < lat > 29.1400926 < / lat >

    < LNG > 44.4116001 < / LNG >

    < / Northeast >

    < / delimits >

    < / geometry >

    < place_id > ChIJcy767DIAYxURohAm-DLSunw < / place_id >

    < / result >

    < result >

    locality < type > < / type >

    < Type > policy < / type >

    Foucart, France < formatted_address > < / formatted_address >

    < address_component >

    < long_name > Foucart < / long_name >

    < short_name > Foucart < / short_name >

    locality < type > < / type >

    < Type > policy < / type >

    < / address_component >

    < address_component >

    < long_name > Seine-Maritime < / long_name >

    < > 76 short_name < / short_name >

    administrative_area_level_2 < type > < / type >

    < Type > policy < / type >

    < / address_component >

    < address_component >

    < long_name > upper Normandy < / long_name >

    < short_name > upper Normandy < / short_name >

    administrative_area_level_1 < type > < / type >

    < Type > policy < / type >

    < / address_component >

    < address_component >

    < long_name > France < / long_name >

    < short_name > EN < / short_name >

    country of < type > < / type >

    < Type > policy < / type >

    < / address_component >

    < geometry >

    < location >

    < lat > 49.6131170 < / lat >

    < LNG > 0.5951040 < / LNG >

    < / location >

    < location_type > APPROX. < / location_type >

    < window >

    < Southwest >

    < lat > 49.6019770 < / lat >

    < LNG > 0.5731880 < / LNG >

    < / Southwest >

    < Northeast >

    < lat > 49.6329760 < / lat >

    < LNG > 0.6081609 < / LNG >

    < / Northeast >

    < / window >

    < limits >

    < Southwest >

    < lat > 49.6019770 < / lat >

    < LNG > 0.5731880 < / LNG >

    < / Southwest >

    < Northeast >

    < lat > 49.6329760 < / lat >

    < LNG > 0.6081609 < / LNG >

    < / Northeast >

    < / delimits >

    < / geometry >

    < place_id > ChIJQdTiHHJc4EcRUIO2T0gUDAQ < / place_id >

    < / result >

    < / GeocodeResponse >


    Here are practically two entries from geo (the /result of xml nodes), and each entry has multiple secondary entries of type address_component and a secondary entrance to the geometry of type.


    I can get the entries in the result of this query:


    SELECT xt.*

    OF zip_tree_sort_xml x,.

    XMLTABLE ("' / GeocodeResponse/result")

    PASSAGE x.google_geodata_xml

    COLUMNS

    Path of 'FORMATTED_ADDRESS' VARCHAR2 (200) "formatted_address".

    ) xt;


    The subnodes XML type address_component and type geometry of teas and those below:


    SELECT xt.*

    OF zip_tree_sort_xml x,.

    XMLTABLE ('/ GeocodeResponse/result/address_component ')

    PASSAGE x.google_geodata_xml

    COLUMNS

    Path of "LONG_NAME' VARCHAR2 (200)"long_name. "

    'SHORT_NAME' VARCHAR2 (500) PATH 'short_name ',.

    Path ACCESS VARCHAR2 (200) from 'TYPE_1' 'type [1]. "

    Path ACCESS VARCHAR2 (200) to 'TYPE_2' 'type [2].

    ) xt;


    SELECT xt.*

    OF zip_tree_sort_xml x,.

    XMLTABLE ("/ GeocodeResponse/result/geometry/location")

    PASSAGE x.google_geodata_xml

    COLUMNS

    "latitude" NUMBER PATH 'lat ',.

    "longitude" NUMBER PATH 'LNG '.

    ) xt;


    But y at - it anyway to join the two subnodes XML below with the parent that above? So I can only get correct result attributes?

    Best regards

    Rodriguez

    But y at - it anyway to join the two subnodes XML below with the parent that above? So I can only get correct result attributes?

    You can do chaining XMLTABLE another that will handle the address_component expandable nodes.

    Data from the geometry node can be extracted at the same level as a result.

    SQL> select x1.formatted_address
      2       , x2.long_name
      3       , x2.short_name
      4       , x2.type_1
      5       , x2.type_2
      6       , x1.latitude
      7       , x1.longitude
      8  from zip_tree_sort_xml t
      9     , xmltable('/GeocodeResponse/result'
     10         passing t.google_geodata_xml
     11         columns
     12           formatted_address   varchar2(200) path 'formatted_address'
     13         , address_components  xmltype       path 'address_component'
     14         , latitude            number        path 'geometry/location/lat'
     15         , longitude           number        path 'geometry/location/lng'
     16       ) x1
     17     , xmltable('/address_component'
     18         passing x1.address_components
     19         columns
     20           long_name   varchar2(200) path 'long_name'
     21         , short_name  varchar2(500) path 'short_name'
     22         , type_1      varchar2(200) path 'type[1]'
     23         , type_2      varchar2(200) path 'type[2]'
     24       ) x2 ;
    
    FORMATTED_ADDRESS       LONG_NAME                   SHORT_NAME                   TYPE_1                         TYPE_2       LATITUDE  LONGITUDE
    ----------------------- --------------------------- ---------------------------- ------------------------------ ---------- ---------- ----------
    76279, Saudi Arabia     76279                       76279                        postal_code                               29,1214197 44,3945656
    76279, Saudi Arabia     Northern Borders Province   Northern Borders Province    administrative_area_level_1    political  29,1214197 44,3945656
    76279, Saudi Arabia     Saudi Arabia                SA                           country                        political  29,1214197 44,3945656
    Foucart, France         Foucart                     Foucart                      locality                       political   49,613117   0,595104
    Foucart, France         Seine-Maritime              76                           administrative_area_level_2    political   49,613117   0,595104
    Foucart, France         Upper Normandy              Upper Normandy               administrative_area_level_1    political   49,613117   0,595104
    Foucart, France         France                      FR                           country                        political   49,613117   0,595104
    
    7 rows selected.
    
  • Add to the XMLTYPE column

    Hello

    I have a requirement to insert a new XML tag in the existing XMLTYPE column.

    Oracle version: Oracle Database 11 g Enterprise Edition Release 11.1.0.7.0 - 64 bit Production

    create table rds_xml_config (module_name varchar2 (32), module_type varchar2 (100), config_xml xmltype);

    insert into rds_xml_config values ('TRANSMIT_SEQ', 'INTERFACE',' < transmit_seq > <!-file sequence number will be updated after each race-> < file = "RTP" Type_de_fichier > < file_seq_num > 2457 < / file_seq_num > < / file > < file Type_de_fichier = 'RTS' > < file_seq_num > 2453 < / file_seq_num > < / file > < Type_de_fichier = "RTL" file > < file_seq_num >) 2522 < / file_seq_num > < / file > < / transmit_seq > ');

    I have to add < file = "RTX" Type_de_fichier > < file_seq_num > 0 < / file_seq_num > < / file >.

    As a temporary work around, I used below the update statement.

    Update rds_xml_config

    Set config_xml =' < transmit_seq > <!-file sequence number will be updated after each race-> < file = "RTP" Type_de_fichier > < file_seq_num > 2457 < / file_seq_num > < / file > < file Type_de_fichier = 'RTS' > < file_seq_num > 2453 < / file_seq_num > < / file > < Type_de_fichier = "RTL" file > < file_seq_num > 2522 < / file_seq_num > < / file > < file = "RTX" file_type > < file_seq_num > 0 < / file_seq_num > < / file > < / transmit_seq > '

    WHERE module_type = "INTERFACE".

    AND module_name = "TRANSMIT_SEQ";

    SEQ numbers will be modified for each race of the file, so I cannot use the work temporary around during migration to production, have we a way to add new XMLtag.

    Thank you

    Rambeau

    Search in INSERTCHILDXML

    http://docs.Oracle.com/CD/B19306_01/server.102/b14200/functions066.htm

    SQL> select a.config_xml.extract('*') old_xml
      2       , insertchildxml(config_xml, '/transmit_seq', 'file',xmltype('10000')).extract('*') new_xml
      3    from rds_xml_config a;
    
    OLD_XML                                                                                              NEW_XML
    ---------------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------
                                                                                           
                                                 
                                                                                     
        2457                                                                 2457
                                                                                                    
                                                                                     
        2453                                                                 2453
                                                                                                    
                                                                                     
        2522                                                                 2522
                                                                                                    
                                                                                            
                                                                                                             10000
                                                                                                           
                                                                                                         
    
  • excerpt from the XMLType column

    In my XMLType column I'm storing XML content that is the xml below.

    <? XML version = "1.0" encoding = "UTF-8"? >

    < project >

    < basics >

    < attribute name = "Id" > 3197915 < / attribute >

    < attribute name = "Name" > 345 < / attribute >

    < attribute name = "Révision" / >

    < name of attribute 'Type' = > project < / attribute >

    < / basics >

    < relationship / >

    < children >

    < application >

    < basics >

    < name of attribute 'Type' = > Application < / attribute >

    < attribute name = "Name" > rty < / attribute >

    < = "Scope" attribute name > SCOPE_PROJECT < / attribute >

    < attribute name = "Révision" / >

    < attribute name = "Id" > 3197918 < / attribute >

    < / basics >

    < relationship type = "Project relationship Configuration" >

    < attribute name = "Subclassification subcomponent" / >

    < attribute name = 'Type of subcomponent' / >

    < attribute name = "Quantity" > 1 < / attribute >

    < attribute name = "Unit of measurement" / >

    < = "Scope" attribute name > SCOPE_PROJECT < / attribute >

    < attribute name = "Post number" / >

    < attribute name = "Additional Information" / >

    < / relationship >

    < children / >

    < / application >

    < typical >

    < basics >

    < name of attribute 'Type' = > rrrr < / attribute >

    < attribute name = "Name" > rrr_Mo < / attribute >

    < attribute name = "Id" > 944674 < / attribute >

    < = "Scope" attribute name > SCOPE_GLOBAL < / attribute >

    < attribute name = "Révision" / >

    < / basics >

    < children / >

    < / typical >

    < application >

    < basics >

    < name of attribute 'Type' = > Application < / attribute >

    < attribute name = "Name" > yu123 < / attribute >

    < = "Scope" attribute name > SCOPE_PROJECT < / attribute >

    < attribute name = "Révision" / >

    < attribute name = "Id" > 3197922 < / attribute >

    < / basics >

    < children / >

    < / application >

    < / children >

    < / project >

    How to write a query to extract the Application name?

    Here, it should return "anais" and "yu123".

    I'm using Oracle 11 g.

    Thanks in advance.

    Something like the following, where TMP_XML. DOC is my XMLType column:

    SQL> select x.*
      2  from tmp_xml t
      3     , xmltable('/Project/Children/Application/Basics'
      4         passing t.doc
      5         columns application_name varchar2(30) path 'Attribute[@Name="Name"]'
      6       ) x
      7  ;
    
    APPLICATION_NAME
    ------------------------------
    rty
    yu123
    
  • XMLTYPE column is PROTECTED or BASIC FILE BINARY?

    Hi all

    I'm working on tables with XMLTYPE columns, I need to identify tables with the XMLType column and its storage type is basicfile or secure binary files?

    Below is an example:

    drop table CHB_SECURE;

    drop table CHB_BASIC_FILE;

    CREATE TABLE CHB_SECURE_FILE

    (

    IDENTIFICATION NUMBER,

    XMLDATA XMLTYPE

    )

    XMLTYPE COLUMN 'XMLDATA' STORE AS BINARY XML NAVIGATION;

    CREATE TABLE CHB_BASIC_FILE

    (

    IDENTIFICATION NUMBER,

    XMLDATA XMLTYPE

    )

    XMLTYPE COLUMN 'XMLDATA' STORE AS BINARY XML BASICFILE;

    When I check the user_tab_cols of view, I found that oracle create new columns with blob types,

    SELECT TABLE_NAME, COLUMN_NAME, DATA_TYPE USER_TAB_COLS WHERE TABLE_NAME IN ('CHB_SECURE_FILE', 'CHB_BASIC_FILE');

    CHB_BASIC_FILEIDNUMBER
    CHB_BASIC_FILEXMLDATAXMLTYPE
    CHB_BASIC_FILESYS_NC00003$BLOB OBJECT
    CHB_SECURE_FILEIDNUMBER
    CHB_SECURE_FILEXMLDATAXMLTYPE
    CHB_SECURE_FILESYS_NC00003$BLOB OBJECT

    Select table_name, column_name, segment_name, a.securefile in the user_lobs where table_name IN ('CHB_SECURE_FILE', 'CHB_BASIC_FILE');

    TABLE_NAMECOLUMN_NAMENOM_SEGMENTSECUREFIL E
    CHB_BASIC_FILESYS_NC00003$SYS_LOB0000768291C00003$ $NO.
    CHB_SECURE_FILESYS_NC00003$SYS_LOB0000768288C00003$ $YES

    In the view of user_lobs, I found that this new addition of columns, I can identify words securefile or not.

    But I can not get this information for xmltype columns.

    I think that there is a relationship between the column SYS_NC00003$ and my column of xmltype XMLDATA but I can not get this information

    Could you please help me?

    Thank you

    Cherif

    I think that there is a relationship between the column SYS_NC00003$ and my column of xmltype XMLDATA but I can not get this information

    Yes, there is a relationship.

    The XMLType column is a virtual column that points to the hidden BLOB where the data is actually stored as binary XML.

    There should be something more simple, but you can use the DBMS_METADATA API to retrieve the information you need:

    SQL > select t.table_name, x.*

    user_tables 2 t

    3, xmltable (xmlnamespaces (default 'http://xmlns.oracle.com/ku'),

    "4 ' / TABLE/RELATIONAL_TABLE/TABLE_PROPERTIES/PROPRIETES_COLONNE/COL_LIST/COL_LIST_ITEM [DATATYPE ="XMLTYPE"]"

    5 passage xmlparse (document dbms_metadata.get_sxml ('TABLE', t.table_name))

    path of varchar2 (30) 6 column column-name 'NAME '.

    7 road of varchar2 (5) is_securefile 'exists(XMLTYPE_PROPERTIES/XMLTYPE_STORAGE/LOB_PROPERTIES/STORAGE_TABLE/SECUREFILE) '.

    8       ) x

    9 where t.table_name in ('CHB_SECURE_FILE', 'CHB_BASIC_FILE')

    10;

    TABLE_NAME COLUMN_NAME IS_SECUREFILE

    ------------------------------ ------------------------------ -------------

    False CHB_BASIC_FILE XMLDATA

    True CHB_SECURE_FILE XMLDATA

  • Ask about the structured storage of XMLTYPE column in Oracle Xml db

    Dear all,

    Version of DB: Oracle 11g (11.2.0.3.0)

    I have a table with an XMLTYPE column with a structured storage.

    CREATE TABLE Orders
        (
        Order_id NUMBER NOT NULL,
        Order_etc VARCHAR2(100),
        Order_desc XMLType NOT NULL
        )
        XMLTYPE Order_desc STORE AS OBJECT RELATIONAL XMLSCHEMA  "http://localhost/public/xsd/order_desc_xsd.xsd" ELEMENT "OrderState";
    

    I then recorded the XSD XML Db schema that is required for the structured storage.

    Before the creation of the table, I had created a table XMLTYPE (db_objects) and was able to use the query to verify that all objects, the XMLTYPE table got broken into when I signed his XSD below.

        SELECT column_name,      
               data_type
        FROM   user_tab_cols
        WHERE  table_name = 'DB_OBJECTS';
    

    And used under query to find data stored in the object-relational structure for my table (DB_OBJECTS) created with definition of XMLTYPE.

      SELECT EXTRACTVALUE(xseq.column_value, '/THISROW/OWNER')       AS owner
        ,      EXTRACTVALUE(xseq.column_value, '/THISROW/OBJECT_NAME') AS object_name
        ,      EXTRACTVALUE(xseq.column_value, '/THISROW/OBJECT_TYPE') AS object_type
        ,      EXTRACTVALUE(xseq.column_value, '/THISROW/OBJECT_ID')   AS object_id
        ,      EXTRACTVALUE(xseq.column_value, '/THISROW/CREATED')     AS created
        FROM   db_objects do
         ,      TABLE(XMLSEQUENCE(EXTRACT(VALUE(do), '/ROWSET/THISROW'))) xseq  
        WHERE  ROWNUM <= 10;
    

    Now could someone let me know, How to find how the column of XMLTYPE (Order_desc) was divided between other objects, just as I did for the Table with XMLTYPE (as shown above)?

    Thank you very much.

    First of all, because you are on 11.2, ExtractValue is obsolete and the documentation lists three options to use instead.  Here's an (untested) option

    SELECT owner, object_name, object_type, object_id, created
      FROM db_objects do,
           XMLTable('/ROWSET/THISROW'
                    PASSING do.object_value
                    COLUMNS
                    -- Set data types accordingly
                    owner        VARCHAR2(20) PATH 'owner',
                    object_name  VARCHAR2(20) PATH 'object_name',
                    object_type  VARCHAR2(20) PATH 'object_type',
                    object_id    VARCHAR2(20) PATH 'object_id',
                    created      VARCHAR2(20) PATH 'created');
    

    Secondly, why the column order matter?  You store in a method of object / relational.  As long as the XML is valid per the schema, Oracle will be able to store the data and thus to retrieve later.  How these data are mainly internal Oracle and shouldn't be touched because it can be changed from one version to another.  You can use the schema annotation to control how Oracle cards and stores the XML content, but nothing in there specifies the column order I know.

    It seems several details are missing information which could help others to answer your question as to what you need.

  • The xmltype column search and listing content in relational format

    Hi all

    I have a database of GR 11, 1 subject table containing the xmltype column. I'm writing a query that displays conetents xml in a relational format.
    SQL*Plus: Release 11.1.0.7.0 - Production on Thu Jan 17 11:45:06 2013
    
    Copyright (c) 1982, 2008, Oracle.  All rights reserved.
    
    
    Connected to:
    Oracle Database 11g Release 11.1.0.7.0 - 64bit Production
    SQL > select * from v version $;

    BANNER
    --------------------------------------------------------------------------------
    Oracle Database 11 g Release 11.1.0.7.0 - 64 bit Production
    PL/SQL Release 11.1.0.7.0 - Production
    CORE Production 11.1.0.7.0
    AMT for 64-bit Windows: Version 11.1.0.7.0 - Production
    NLSRTL Version 11.1.0.7.0 - Production

    SQL > BULKMESSAGES Desc;
    Name of Type Null
    --------------- ---- -------------
    TRANSFER_ID VARCHAR2 (100)
    TRANSFER_LOGS XMLTYPE()
    TRANSFER_RESULT VARCHAR2 (10)

    SQL > select * from BULKMESSAGES
    where TRANSFER_RESULT = "REFUSED."
    /
    TRANSFER_ID TRANSFER_LOGS TRANSFER_RESULT
    ---------------- ---------------------------------------------------------------- ---------------
    T3217 < env:Envelope xmlns:env = 'http://www.w3.org/2003/05/soap-envelope' > REJECTED



    Column of xmltype TRNASFER_LOGS stores the SOAP responses. Response SOAP sample (dummied) of the TRANSFER_LOGS xml column is below:
    <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
         <env:Header xmlns:env="http://www.w3.org/2003/05/soap-envelope"/>
         <env:Body xmlns:env="http://www.w3.org/2003/05/soap-envelope">
              <env:Fault xmlns:env="http://www.w3.org/2003/05/soap-envelope">
                   <env:Code xmlns:env="http://www.w3.org/2003/05/soap-envelope">
                        <env:Value xmlns:env="http://www.w3.org/2003/05/soap-envelope">env:Receiver</env:Value>
                        <env:Subcode xmlns:env="http://www.w3.org/2003/05/soap-envelope">
                             <env:Value xmlns:fault="http://www.es.com/soapfaults" xmlns:env="http://www.w3.org/2003/05/soap-envelope">fault:MessageBlocked</env:Value>
                        </env:Subcode>
                   </env:Code>
                   <env:Reason xmlns:env="http://www.w3.org/2003/05/soap-envelope">
                        <env:Text lang="en" xmlns:env="http://www.w3.org/2003/05/soap-envelope">connection rejected</env:Text>
                   </env:Reason>
                   <env:Detail xmlns:fault="http://www.es.com/soapfaults" fault:type="faultDetails" fault:messageId="0000013a6" xmlns:env="http://www.w3.org/2003/05/soap-envelope">
                        <fault:path policy="Request Message">
                             <fault:filter status="Fail" name="Call 'Process request '">
                                  <fault:path policy="Process xml ">
                                       <fault:filter status="Fail" name="Call 'Call 3rdparty service'">
                                            <fault:path policy="Call external service">
                                                 <fault:filter status="Pass" name="Extract message"/>
                                            </fault:path>
                                       </fault:filter>
                                  </fault:path>
                             </fault:filter>
                        </fault:path>
                        <fault:attributes>
                             <fault:attribute name="monitoring.enabled" value="true"/>
                             <fault:attribute name="requestor" value="none"/>
                             <fault:attribute name="circuit.failure.reason" value="connection rejected"/>
                             <fault:attribute name="message_protocol" value="SOAP"/>
                             <fault:attribute name="user_id" value="31274556"/>
                             <fault:attribute name="ws_name" value="PUSHDOC"/>
                             <fault:attribute name="user.enabled" value="N"/>
                             <fault:attribute name="http.request.clientaddr" value="/10.254.123.44:43840"/>
                             <fault:attribute name="soap_action" value="pushDocument"/>
                             <fault:attribute name="message.reception_time" value="1349769769742"/>
                             <fault:attribute name="user.api_logging_flag" value="Y"/>
                             <fault:attribute name="circuit.exception" value="com.es.circuit.CircuitAbortException: connection rejected"/>
                             <fault:attribute name="end_point" value="https://es.live.com/pdfs"/>
                             <fault:attribute name="message.protocol.type" value="http"/>
                             <fault:attribute name="user.incoming_date" value="09-11-2013 09:02:49"/>
                             <fault:attribute name="http.destination.host" value="es.live.com"/>
                             <fault:attribute name="message.local.address" value="/100.25.40.82:8085"/>
                             <fault:attribute value="N"/>
                        </fault:attributes>
                   </env:Detail>
              </env:Fault>
         </env:Body>
    </env:Envelope>
    My goal is to search for documents TRANSFER_LOGS for lines that contain flaws: attribute name = "circuit.exception". Then report "fault: name attribute" and their values in relational format. For example:
    TRANSFER_ID    TRANSFER_RESULT FAULT_FAIL_REASON    FAULT_CIRCUIT_EXCEPTION                               FAULT_WS_NAME   FAULT_DESTINATION_HOST
    ----------     --------------- ----------------     -------------------------------------------------------- -------------   ---------------------
    T3217          REJECTED       CONNECTION REJECTED  com.es.circuit.CircuitAbortException: connection rejected  PUSHDOC       es.live.com
    I am new to oracle XML sql querying. Documents in the column of xmltype TRANSFER_LOGS have many namespaces and the query I've tried does not work. So, any help or pointers to search and extract TRANSFER_LOGS in above format is greatly appreciated.

    Thanks in advance.

    VC

    Hello

    You can use something like this:

    SQL> select t.transfer_id, t.transfer_result, x.*
      2  from bulkmessages t
      3     , xmltable(
      4         xmlnamespaces(
      5           'http://www.w3.org/2003/05/soap-envelope' as "e"
      6         , 'http://www.es.com/soapfaults' as "f"
      7         )
      8       , '/e:Envelope/e:Body/e:Fault/e:Detail/f:attributes'
      9         passing t.transfer_logs
     10         columns
     11           FAULT_FAIL_REASON       varchar2(200) path 'f:attribute[@name="circuit.failure.reason"]/@value'
     12         , FAULT_CIRCUIT_EXCEPTION     varchar2(200) path 'f:attribute[@name="circuit.exception"]/@value'
     13         , FAULT_WS_NAME           varchar2(200) path 'f:attribute[@name="ws_name"]/@value'
     14         , FAULT_DESTINATION_HOST  varchar2(200) path 'f:attribute[@name="http.destination.host"]/@value'
     15         ) x
     16  where xmlexists(
     17         'declare namespace e = "http://www.w3.org/2003/05/soap-envelope"; (: :)
     18          declare namespace f = "http://www.es.com/soapfaults"; (: :)
     19          /e:Envelope/e:Body/e:Fault/e:Detail/f:attributes/f:attribute[@name="circuit.exception"]'
     20          passing t.transfer_logs
     21        ) ;
    
    TRANSFER_ID     TRANSFER_RESULT FAULT_FAIL_REASON        FAULT_CIRCUIT_EXCEPTION                                       FAULT_WS_NAME    FAULT_DESTINATION_HOST
    --------------- --------------- ------------------------ ------------------------------------------------------------- ---------------- -------------------------
    T3217           REJECTED        connection rejected      com.es.circuit.CircuitAbortException: connection rejected     PUSHDOC          es.live.com
     
    

    Or, more simply:

    SQL> select t.transfer_id, t.transfer_result, x.*
      2  from bulkmessages t
      3     , xmltable(
      4         xmlnamespaces(
      5           'http://www.w3.org/2003/05/soap-envelope' as "e"
      6         , 'http://www.es.com/soapfaults' as "f"
      7         )
      8       , '/e:Envelope/e:Body/e:Fault/e:Detail/f:attributes'
      9         passing t.transfer_logs
     10         columns
     11           FAULT_FAIL_REASON       varchar2(200) path 'f:attribute[@name="circuit.failure.reason"]/@value'
     12         , FAULT_CIRCUIT_EXCEPTION     varchar2(200) path 'f:attribute[@name="circuit.exception"]/@value'
     13         , FAULT_WS_NAME           varchar2(200) path 'f:attribute[@name="ws_name"]/@value'
     14         , FAULT_DESTINATION_HOST  varchar2(200) path 'f:attribute[@name="http.destination.host"]/@value'
     15         ) x
     16  where x.FAULT_CIRCUIT_EXCEPTION is not null ;
    
    TRANSFER_ID    TRANSFER_RESULT FAULT_FAIL_REASON      FAULT_CIRCUIT_EXCEPTION                                      FAULT_WS_NAME      FAULT_DESTINATION_HOST
    -------------- --------------- ---------------------- ------------------------------------------------------------ ------------------ --------------------------
    T3217          REJECTED        connection rejected    com.es.circuit.CircuitAbortException: connection rejected    PUSHDOC            es.live.com
      
    
  • Compare the values of the XMLType column to two different lines using XMLDiff in GR 11, 2

    I have a table of data with a row of XMLType and I need a way to compare the XML data against the other. I guess I could use a function and return a XMLDIFF base output to the caller, but the function logic is a bit fuzzy. Would be nice to format the output finally in a table format.

    I looked on http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions241.htm#SQLRF20025 and output in a format of table as shown in Re: how to find compare and identify between xmldocs .

    I ran across some examples do not explain the best way to compare the XML code that is in the best performing XMLType column.

    Any help would be appreciated.

    Are you referring to different rows in the same table or different tables or?

    Basically, you need to change the example of Odie so that the XMLDiff retrieves the XML from places in Pb, say something like

    XMLDIFF(SELECT aXml FROM table WHERE ...,
            SELECT bXml FROM table WHERE ...)
    

    This allows to avoid bringing the XML of the DB in the client code.

    Don't know if that's what you're looking for, but hopefully it helps a little.

  • XMLType - reorganize nodes?

    I tried to migrate Berkeley DB XML to Oracle XML DB. Each container of Berkeley DB XML has become one table of relational database in Oracle XML DB with an XMLType column to contain the XML document:
    CREATE TABLE MyTable 
        (
            id VARCHAR2(1024) PRIMARY KEY, 
            xml XMLTYPE NOT NULL
        ) XMLType COLUMN Xml STORE AS CLOB 
          XMLSCHEMA "http://xmlns.abc.de/xdb/schemas/RTIDB/abcfinlib.xsd" ELEMENT "abcfinlib"
    In my application Java migration I ask Berkeley DB XML XML document and insert it on the fly in the appropriate Oracle XML DB table.

    When I now selects the document XML of the Berkeley DB XML and the Oracle XML DB (to check if the copy has been a success and the two XML documents an equal somehow) XML documents are not equal because parts of the XML in the Oracle XML DB are placed in other locations in the XML document.
    What is a behavior known to Oracle XML DB? I have to say one other thing when creating the database table?
    How can I stop rearraning the XML document?

    Oracle 11g 11.2

    I created a problem where no problem is not at all? ;)

    Looks like so much ;)

  • Cannot load in the XMLTYPE column

    HI gentlemen,

    I have enormous difficulty with loading the XML content in an XMLTYPE column. Here's the annotated schemas:
    SQL> select any_path from resource_view where any_path like '%GKSADMIN/ICD%';
    
    ANY_PATH                                                                        
    --------------------------------------------------------------------------------
    /sys/schemas/GKSADMIN/ICD                                                       
    /sys/schemas/GKSADMIN/ICD/datentypen_V1.40.xsd                                  
    /sys/schemas/GKSADMIN/ICD/ehd_header_V1.40.xsd                                  
    /sys/schemas/GKSADMIN/ICD/ehd_root_V1.40.xsd                                    
    /sys/schemas/GKSADMIN/ICD/icd_body.xsd                                          
    /sys/schemas/GKSADMIN/ICD/icd_header.xsd                                        
    /sys/schemas/GKSADMIN/ICD/icd_root.xsd                                          
    /sys/schemas/GKSADMIN/ICD/keytabs_V1.40.xsd                                     
    
    8 Zeilen ausgewählt.
    And here's the relational table:
    SQL> describe icd
     Name                                      Null?    Typ
     ----------------------------------------- -------- ----------------------------
     ID                                                 CHAR(2)
     XML_DOCUMENT                                       SYS.XMLTYPE(XMLSchema "ICD/i
                                                        cd_root.xsd" Element "ehd") 
                                                        STORAGE Object-relational TY
                                                        PE "ICD$ICD_ROOT_TYP"
    Now, when I try to load a document instance (which proved OK with xmloracle), the following occurs:
    SQL> @loadxmlfileascolumn_int
    Geben Sie einen Wert für source_directory ein: c:\gks\kbv\c\icd\xml
    alt   1: create or replace directory SOURCE_DIR as '&source_directory'
    neu   1: create or replace directory SOURCE_DIR as 'c:\gks\kbv\c\icd\xml'
    
    Verzeichnis wurde erstellt.
    
    Geben Sie einen Wert für xmltypetable ein: icd
    alt   4:   INSERT INTO &XMLTypeTable
    neu   4:   INSERT INTO icd
    Geben Sie einen Wert für id ein: 01
    Geben Sie einen Wert für instancedocument ein: icdtest.xml
    alt   5:     VALUES (&id, XMLType(bfilename('SOURCE_DIR', '&InstanceDocument'),
    neu   5:     VALUES (01, XMLType(bfilename('SOURCE_DIR', 'icdtest.xml'),
    declare
    *
    FEHLER in Zeile 1:
    ORA-01830: Datumsformatstruktur endet vor Umwandlung der gesamten 
    Eingabezeichenfolge 
    ORA-06512: in Zeile 4 
    
    
    SQL> spool off
    Because the patterns are very big, I took only one to show the relevant parts:
        <ehd:document_type_cd V="ICD" DN="ICD-Stammdatei" S="1.2.276.0.76.5.100"/>
        <ehd:service_tmr V="2010-01-01..2010-12-31"/>
        <ehd:origination_dttm V="2009-11-10+01:00"/>
    Guilty is allegedly origination_dttm with its time zone. However, consider the resolution of type below that leads to XS: date. This should be able to accommodate the time zone as well.
         <!-- ************************ origination_dttm_typ ********************************* -->
         <xs:element name="origination_dttm" type="origination_dttm_typ">
              <xs:annotation>
                   <xs:documentation>Erstellungsdatum</xs:documentation>
              </xs:annotation>
         </xs:element>
         <xs:complexType name="origination_dttm_typ">
              <xs:complexContent>
                   <xs:extension base="v_date_typ"/>
              </xs:complexContent>
         </xs:complexType>
    
         v_date_typ: enthält nur den V-Attribut für einfache Datums-Angaben
    
         <!-- ************************ v_date_typ ********************************** -->
         <xs:complexType name="v_date_typ">
              <xs:attribute name="V" type="xs:date" use="required"/>
         </xs:complexType>
    When I delete the passage of time zone in the document instance, it works again.
    (However, another error will be reported then - another question.)

    Can you help me to know what is the problem? Is this my error or a bug?

    Thank you, best regards,.

    Miklós HERBOLY

    Published by: mh * July 3, 2011 10:55

    It's Oracle functionality (at least in 11g R2). See working with zones of the XML DB Developer's Guide: http://download.oracle.com/docs/cd/E11882_01/appdev.112/e16659/xdb05sto.htm#autoId62

    The chapter also includes an example how to adjust the schema with Oracle specific annotation.

    See also http://stackoverflow.com/questions/6370035/why-dbms-xmlschema-fails-to-validate-a-valid-xsdatetime/6382096#6382096

    Published by: 836290 on July 4, 2011 07:56

  • ADF and the use of the XMLType columns

    After discovering the Jdeveloper 11 g was able to generate business components/data controls for complex web services (see this tutorial excellet http://www.oracle.com/technology/tech/fmw4apps/agile/pdf/adf11g-agile.pdf), I assumed that jdev 11 g should now have the same capacity on XMLtype columns with a registered scheme, and was therefore a good match for our enforcement objectives be able to edit
    parts of an XML document to aid in the face of components and Assembly/store the document in a way centic document in a relational/XML database XMLType column hybrid.

    I tested this point, has created a table with an XMLType column binary, saved the schema in database (11g) and jdev(11g) and generated my components.


    I was very disappointed at the discovery of the structure of data controls stops at the level of the attribute in the table (ie the XMLType column), so none of the structure of the XML document is revealed or can be used in a meaningful way through data control.

    Am I missing something here? should not control data generated reveal the XML structure and allow the use of components of forms/table faces on some parts of the structure of the document? I'm not a java programmer, so was really hoping to do this with data not generated controls beans not.

    If it is just to treat it as a CLOB, what's the point of registered xsd schemas?

    Yes, it is through java. Sorry

  • Inserting XML data in xmltype column

    Oracle version: 10.1.0.5
    OpenVms Alpha V8.3

    (1) tried this and getting the error below. Place a zero and remove charset. Same mistake.

    INSERT INTO xml_demo (donnees_xml) - xmltype column
    VALUES
    (
    XmlType
    (
    BFILENAME ('XML_DIR ',' MOL.) XML').
    nls_charset_id ('AL32UTF8')
    ),
    );


    ORA-22993: much of the specified input is greater than the quantity real source
    ORA-06512: at "SYS." DBMS_LOB", line 637
    ORA-06512: at "SYS." XMLTYPE", line 283
    ORA-06512: at line 1


    (2) this PL/SQL block works. However maximum brute size about 32K. The file may be around 100 K. May be I can load into a table of raw and somehow concatnate to insert. Not sure if it's possible, but I'm sure there must me a simple way to do this.

    Subset of the xml file is pasted below.


    Set serveroutput size 1000000
    DECLARE
    bfile file1;
    XMLType v_xml;
    len1 number (6);
    v_rec1 raw (32000);

    BEGIN
    File1: = bfilename ('XML_DIR ',' MOL.) XML');
    DBMS_LOB. FileOpen (File1, DBMS_LOB.file_readonly);
    len1: = DBMS_LOB.getLength (file1);
    v_rec1: = dbms_lob.substr(file1,len1,1);
    v_xml: = xmltype (UTL_RAW. CAST_TO_VARCHAR2 (v_rec1));

    INSERT INTO xml_demo (donnees_xml) VALUES (v_xml);
    COMMIT;
    DBMS_LOB. FileClose (file1);

    exception
    while others then
    dbms_output.put_LINE (sqlerrm);
    DBMS_LOB. FileClose (file1);
    END;
    /




    <? XML version = "1.0" encoding = "UTF-8"? >
    < MolDocument DtdVersion = "3" DtdRelease = "0" >
    < DocumentIdentification v = "MOL_20100331_1500_1600" / >
    < DocumentVersion v = "1" / >
    < V DocumentType = "A43" / >
    < CodingScheme = v "A01" SenderIdentification = "17X100Z100Z0001H" / >
    < SenderRole v = "35" / >
    < ReceiverIdentification codingScheme = v "A01" = "10XFR-TEN - Q" / >
    < ReceiverRole v = "A04" / >
    < CreationDateTime v = "2010-03 - 31 T 14: 10:00Z" / >
    < ValidTimeInterval v = "2010-03 - 31 T 15: 00Z / 2010-03 - 31 T 16: 00Z" / >
    < codingScheme domain = "A01" v = "10YDOM-1001A001A" / >
    < MolTimeSeries >
    < ContractIdentification v = "RTE_20100331_1500_16" / >
    < ResourceProvider codingScheme = v "A01" = "10XFR-TEN - Q" / >
    < CodingScheme = v "A01" AcquiringArea = "17Y100Z100Z00013" / >
    < ConnectingArea codingScheme = v "A01" = "10YFR-TEN - C" / >
    < AuctionIdentification v = "AUCTION_20100331_1500_1600" / >
    < BusinessType v = "10" / >
    < BidTimeInterval v = "2010-03 - 31 T 15: 00Z / 2010-03 - 31 T 16: 00Z" / >
    < MeasureUnitQuantity v = "MAW" / >
    < v currency = "EUR" / >
    < MeasureUnitPrice v = "MWH" / >
    < v direction = "A02" / >
    < MinimumActivationQuantity v = "50" / >
    < v status = "A06" / >
    < period >
    < v TimeInterval = "2010-03 - 31 T 15: 00Z / 2010-03 - 31 T 16: 00Z" / >
    < resolution v = "PT60M" / >
    <>interval
    < v pos = "1" / >
    < v Qty = "50" / >
    < character v = "50.45" / >
    < / interval >
    < / period >
    < / MolTimeSeries >
    < / MolDocument >

    Hello

    A couple of workarounds, try:

    DECLARE
    
       v_lob   CLOB;
       v_file  BFILE;
    
    BEGIN
    
       v_file := BFILENAME('XML_DIR','mol.xml');
       DBMS_LOB.createtemporary(v_lob, true);
       DBMS_LOB.fileopen(v_file);
       DBMS_LOB.loadfromfile(v_lob, v_file, DBMS_LOB.getlength(v_file));
    
       INSERT INTO xml_demo VALUES( xmltype(v_lob) );
    
       DBMS_LOB.fileclose(v_file);
       DBMS_LOB.freetemporary(v_lob);
    
    END;
    /
    

    or,

    DECLARE
    
       v_lob   CLOB;
    
    BEGIN
    
       v_lob := DBMS_XSLPROCESSOR.read2clob('XML_DIR', 'mol.xml', nls_charset_id('AL32UTF8'));
    
       INSERT INTO xml_demo VALUES( xmltype(v_lob) );
    
    END;
    /
    
  • What is the default size of the XMLType column?

    I have a table with 1 type of crude and 1 XMLType column. In the XMLType column I'm inserting XML, more

    < ocaStatus xmlns = "http://xmlbeans.apache.org/ocastatus" >
    < status >
    < > 990 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2010 - 01 - 19 < / statusDate >
    < user name > OcaNimsAcf < / userId >
    < comment > DocumentnotinNIMS < / comment >
    < / status >
    < status >
    < > 990 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2010 - 01 - 19 < / statusDate >
    < user name > OcaNimsAcf < / userId >
    < comment > DocumentnotinNIMS < / comment >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 09 - 16 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 09 - 16 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 09 - 16 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 29 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 29 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 28 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 28 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 27 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 26 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 25 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 22 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 22 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 22 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 22 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 22 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 21 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 21 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 21 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 21 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 21 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 20 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 20 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 20 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < statusCode > 306 < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 04 - 21 < / statusDate >
    < user name > u0075970 < / userId >
    < / status >
    < status >
    < > 301 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 02 - 05 < / statusDate >
    < user name > DMS_WORKFLOW < / userId >
    < comment > < / comment >
    < / status >
    < status >
    < > 990 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2010 - 01 - 17 < / statusDate >
    < user name > OcaNimsAcf < / userId >
    < comment > Comparedfornimsacf < / comment >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 09 - 16 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 09 - 16 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 09 - 16 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 29 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 29 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 28 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 28 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 27 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 26 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 25 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 22 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 22 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 22 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 22 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 22 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 21 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 21 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 21 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 21 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 21 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 20 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 20 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 20 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < statusCode > 306 < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 04 - 21 < / statusDate >
    < user name > u0075970 < / userId >
    < / status >
    < status >
    < > 301 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 02 - 05 < / statusDate >
    < user name > DMS_WORKFLOW < / userId >
    < comment > < / comment >
    < / status >
    < / ocaStatus >

    The XML is very long. For insertion in the table, I use xmlparse() function to get XMLType.
    While doing this I'm ORA-01704: string literal too long error. It is said can accommodate maximum 4,000 characters.
    I guess that XMLType is stored as a default CLOB. So it should allow more than 4000 characters.
    How can I store data xml with more than 4000 characters.

    Thank you.

    XMLParse is a SQL function, you cannot use a string literal is longer than 4000 characters.

    Instead, you can declare a PL/SQL VARCHAR2 variable, which can contain up to 32 k characters and use the XMLType constructor:

    DECLARE
    
     xmlstr VARCHAR2(32767) := '';
     xmldoc xmltype;
    
    BEGIN
    
     xmldoc := xmltype(xmlstr);
     INSERT INTO your_table(xml_data) VALUES(xmldoc);
    
    END;
    

    For strings longer than 32 k, you may need to load it from a file.

  • Creating indexes in the XMLType column

    Hello

    I have the following for XML document stored as an XMLType column.

    < ocaStatus xmlns = "http://xmlbeans.apache.org/ocastatus" > < status > < > 934 statusCode < / statusCode > < statusDate > Wed Apr 07 16:05:53 GMT + 05:30 2010 < / statusDate > < userId > u0121845 < / userId > < comment > sent to FLC < / comment > < / status > < status > < statusCode > 934 < / statusCode > < statusDate > Wed Apr 07 15:58:25 GMT + 05:30 2010 < / statusDate > < userId > u0121845 < / username > < Comment > sent to FLC < / comment > < / status > < status > < statusCode > 934 < / statusCode > < statusDate > Wed Apr 07 15:54:02 GMT + 05:30 2010 < / statusDate > < userId u0121845 > < / userId > < comment > sent to FLC < / comment > < / status > < status > < statusCode > 750 < / statusCode > < statusDate > 2010 - 03 - 31 12:39:41.580 GMT + 05:30 < / statusDate > < u0121845 userId > < / userId > < comment > metadata of the Document is correct. < / comment > < / status > < status > < statusCode > 934 < / statusCode > < statusDate > 2010 - 03 - 31 12:39:41.580 GMT + 05:30 < / statusDate > < userId > u0121845 < / userId > < comment > sent to FLC < / comment > < / status > < status > < statusCode > 932 < / statusCode > < statusDate > 2010 - 03 - 31 12:39:41.580 GMT + 05:30 < / statusDate > < userId > u0121845 < / username > < comment > loaded Novus < /. comment > < / status > < status > < > 700 statusCode < / statusCode > < statusDate > 2010 - 03 - 31 12:39:41.580 GMT + 05:30 < / statusDate > < userId u0121845 > < / userId > < comment > Document is deleted from the OCA. < / comment > < / status > < / ocaStatus >

    I created as a result of the clues in the XML
    CREATING INDEX 'OCA_DEV '. "' OCA_STATUS_CODE_INDEX ' ON 'OCA_DEV '. "DOCUMENT_STATUS_XML"(EXTRACTVALUE('/ocaStatus/status/statusCode'));
    CREATING INDEX 'OCA_DEV '. "' OCA_STATUS_DATE_INDEX ' ON 'OCA_DEV '. "DOCUMENT_STATUS_XML"(EXTRACTVALUE('/ocaStatus/status/statusDate'));

    However, the problem is that I will be having several status within each XML that violates the indexing.
    Is there a way I can still create indexes for multiple State values in each XML file?

    Thanks in advance.

    Hello

    Take a look at the manual xdb (which version do you use?), for the 10.2 version, see: http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14259/xdb04cre.htm#sthref596
    It describes how you can index an XMLTYPE. Because you describe how you use, take a look at your needs.

    In 11G, you have the XMLINDEX to xmltypes indexing, you will find information here: http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10492/xdb_indexing.htm#CHDFCGGI

    Herald tiomela
    Superconsult.nl

Maybe you are looking for