Object Table of XMLType vs single column of XMLType Table

What are the differences between the XMLType table object and a table with a single column of XMLType?

It's

CREATE TABLE XMLType xml_table;

and

CREATE TABLE xml_table (xml_field XMLTYPE);

That should be used and when? Both may be declared to be aware of schema.

The main difference is that an XMLType object array allows the use of the XML DB Repository to store and retrieve XML content.
The relationship between a resource and its content is maintained by a "pointer" (REF XMLType) line in the XMLType table:

http://docs.Oracle.com/CD/E11882_01/AppDev.112/e23094/xdb03usg.htm#ADXDB4223
http://docs.Oracle.com/CD/E11882_01/AppDev.112/e23094/xdb03usg.htm#BJFBDEJE

Tables based on the patterns of XMLType (including the associated nested structure) can also be created automatically through recording scheme, which is very convenient when the pattern becomes complex.
In addition, a registred schema-compliant documents that go into the repository automatically stored in the table by default (see the annotation xdb:defaultTable).
We can also use ACLs to control access to specific rows in a table of object XMLType.

This is not possible with XMLType columns in a relational table.

Tags: Database

Similar Questions

  • Two foreign keys of a table in a single column

    Hi gurus

    I wonder that can we add two foreign keys of a table on a single column, I think the answer is, but what should be the reason behind this?

    Appreciate if someone there explain to me...

    Concerning

    Muzz

    Hello Muzz,

    Perhaps the example of human Chen reveals a design error.
    If a student has a 'teacher_id' "teacher" FK and FK for "emp" becaue each teacher is an EMP, I guess that the correct design would be to have only the FK of 'teacher' and to have another pointing to the 'emp' table in the 'teacher' tabe FK

    But we can imagine comical situations...
    CREATE TABLE PEOPLE (id NUMBER of KEY PRIMARY, name VARCHAR2 (20 CHAR),...);
    CREATE TABLE SCIENTIST (id people KEY PRIMARY NUMBER (id) REFERENCES, discipline VARCHAR2 (20 CHAR),...);
    CREATE TABLE POLICEMAN (id REFERENCES to KEY PRIMARY NUMBER (id), hire_date people DATE,...);

    First table = all.
    2nd: a subset of the first, with people having the profile of 'scientific '...
    3rd: a subset of the first, with people being a policeman.
    It might be people first table and in none of the 2nd and 3rd, 1st and 2nd, 1st and 3rd only or in the 3 tables.

    Then we can have a fourth table of 'something' referring to a person who must be a scientist and a police officer.

    Here is a sqlplus session illustrating; the last piece: I try inserting several lines in xxxx, only the last is accepted.

    SQL > CREATE TABLE PEOPLE (id NUMBER of the PRIMARY KEY, name VARCHAR2 (20 CHAR));
    Table created.

    SQL > CREATE TABLE SCIENTIST (people of REFERENCES of KEY PRIMARY NUMBER id (id), discipline VARCHAR2 (20 CHAR));
    Table created.

    SQL > CREATE TABLE POLICEMAN (people of REFERENCES of KEY PRIMARY NUMBER id (id), DATE hire_date);
    Table created.

    SQL > CREATE TABLE XXXX (id PRIMARY KEY NUMBER, people_id NUMBER, any other VARCHAR2 (30 CHAR));
    Table created.

    SQL > ALTER TABLE ADD CONSTRAiNT fk_xxsci FOREIGN KEY (people_id) scientific xxxx REFERENCES (id);
    Modified table.

    SQL > ALTER TABLE ADD CONSTRAiNT fk_xxpol FOREIGN KEY (people_id) police xxxx REFERENCES (id);
    Modified table.

    SQL > INSERT INTO person VALUES (100, 'John');
    1 line of creation.

    SQL > INSERT INTO person VALUES (120, 'Mary');
    1 line of creation.

    SQL > INSERT INTO person VALUES (103, 'Tom');
    1 line of creation.

    SQL > INSERT INTO person VALUES (123, "Bruno");
    1 line of creation.

    SQL > INSERT INTO VALUES of scientific (120, 'Chemistry');
    1 line of creation.

    SQL > INSERT INTO scientific VALUES (123, 'Mathematics');
    1 line of creation.

    SQL > INSERT INTO VALUES of policeman (103, DATE ' 2001-04-01');
    1 line of creation.

    SQL > INSERT INTO VALUES of policeman (123, DATE ' 1998-07-01');
    1 line of creation.

    SQL > INSERT INTO xxxx VALUES (1, 456, "nothing");
    ERROR on line 1:
    ORA-02291: integrity constraint (SYS. FK_XXPOL) violated - key parent not found

    SQL > INSERT INTO xxxx VALUES (1, 100, "only to people");
    ORA-02291: integrity constraint (SYS. FK_XXPOL) violated - key parent not found

    SQL > INSERT INTO xxxx VALUES (1, 120, "only the learned");
    ORA-02291: integrity constraint (SYS. FK_XXPOL) violated - key parent not found

    SQL > INSERT INTO xxxx VALUES (1, 103, "only police officer");
    ORA-02291: integrity constraint (SYS. FK_XXSCI) violated - key parent not found

    SQL > INSERT INTO xxxx VALUES (1, 123, 'ok');
    1 line of creation.

    Best regards

    Bruno Vroman.

  • Assistance in creation of objects Table nested in a column

    Hi all

    In our project requirement, we are supposed to create a table1 consisting of such object1 of the column and Object1 has a nested object (object2) as one of the column.

    We are able to create the table (table-name is op_sam) for object1

    create or replace type testobj1 as an object (number of c1, c2 number);
    create or replace type t_testobj in the testobj1 table;

    create table op_sam (obj_id varchar2 (100), workobj t_testobj)
    store workobj table nested as nested_tab back as a value;

    We strive to store op_sam as an object in an another table prepop

    We have created the object for the op_sam

    create or replace type op_sam_obj as an object (obj_id varchar2 (100), workobj t_testobj);
    create or replace type t_op_sam_obj in the op_sam_obj table;



    We gave the following script to create the table with the column as t_op_sam_obj

    create table prepop (ob_id varchar2 (20), t_op_sam_obj object2)
    nested table object2 store like nested_tab1 back as a value;


    ORA-22913: must specify the name of the table for the nested table column or attribute · nested tables ·

    could you please suggest me to fix this?

    Hello

    Each object of type table needs a nested table.
    Subject: object2 has a nested table object: workobj
    Then, who also has a nested table clause.

    CREATE
         TABLE prepop
         (
              ob_id VARCHAR2(20)
         , object2 t_op_sam_obj
         )
         nested TABLE object2 store AS nested_tab1
         (
              nested TABLE workobj store AS nested_tab2
         )
            return as value
    ;
    

    This will create 3 tables:
    nested_tab2 as an embedded table
    nested_tab1 as an embedded table
    prepop

    Kind regards

    Peter

  • List of tables of objects or the user-defined type columns

    Hello

    SQL > select * from v version $;

    BANNER
    --------------------------------------------------------------------------------
    Oracle Database 11 g Enterprise Edition Release 11.2.0.2.0 - 64 bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    CORE Production 11.2.0.2.0
    AMT for Linux: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production

    I have n number of tables in my db, since I have several
    tables containing "user defined type columns.
    so, how can I get/list db objects that contains the user-defined type columns only.
    Please suggest me on this

    Kind regards
    Faiz

    Dear Sir

    I have n number of tables in my db,from that i have several
    tables which contains"user defined type columns"
    so how could i get/list the db objects which contains user defined type columns only.
    Kindly suggest me on this
    

    Use this

    select
          tab.table_name
        , tab.column_name
        , tab.data_type
    from
        user_tab_columns tab
      , user_types typ
    where
        tab.data_type = typ.type_name
    order by
        tab.table_name
        ;
    

    Best regards

    Mohamed Houri

  • PanelBox and the single column Table

    Hi all

    I have a panelBox with a table T1 single column. I would like to add an array of columns more simple T2 right next to the first table T1.
    Jdev he added under the first table, but I want to be in the same line.

    Is this possible?


    Thank you
    Matthew

    Hi Matthew,

    How to add panelGroupLayout with a horizontal layout inside panelBox and put your tables inside the panelGroupLayout?

    Jean Lou

  • Validation of a single column in a table

    Hello

    I have one with a tabular form. Where/how can I write the validation of a single column (do not duplicate) in this

    in table form. Help, please

    Thank you

    TJ

    Hello

    In my page 11 examples contain some sort solution for this
    http://Apex.Oracle.com/pls/OTN/f?p=40323:11

    You can download the app and check it

    BR, Jari

  • Merge multiple columns into a single column?

    Hello

    I need to perform queries dynamically and the return values. I need to retrieve the values of the queries in a single column only by concatenating multiple columns. I can't use the PL/SQL in my scenario.
    is it possible to run a query and the result will be extracted in a single column (multiple column values must be concatenated)?

    Thank you
    Raja.
    SELECT rtrim(extract(xmltype(REPLACE(column_value,'
    

    Check this box... Copy it directly to this

    Ravi Kumar

  • Remove the clicked point of Listbox (single column)

    Hello

    It seems a lot of posts on clear lines of the programmatically multicolumn listbox but not the only column listboxes.

    Woth the help of Martins and GerdW, helped me build a subset of a ListBox with items clicked in a reference list

    Make a table of items clicked in a list

    . How it adds a feature to delete just in case rather than the deletion of the entire list and do it all over again.

    Thanks in advance.

    Have an array of strings to the "REF" enter in the list box and store it on a shift register. When you remove an item (for example, for an event), remove this item from the list (using the removal of the table) and write back to the property Ref of the listbox. A single-column list box works exactly the same way as a multicolumn listbox.

    (Excuse the broken links to properties - what happens when you create an excerpt)

  • Single-column-multi-Rows, columns by using Types of Collection

    Can you guys help me get the result after using types of collection or all the predefined collections?

    In fact, I'm trying to compare the results of the columns col1 and col2 against a single value, so try to get the output in a single column.

    Required output should be like

    SQL > with t as (1 select col1, col2 2 double)

    2 Select * from t;

    COL

    ----------

    1

    2

    Please suggest any solutions using regexp/connect by / or etc.

    Well, then:

    SQL> with t as (select 1 col1, 2 col2 from dual)
      2  select nt.column_value
      3  from t
      4     , table(sys.odcinumberlist(col1, col2)) nt
      5  ;
    
    COLUMN_VALUE
    ------------
               1
               2
    

    but it is overkill IMO.

  • Several links in the single column

    Hello

    I have a requirement to display several links in the single column.

    Example:

    Select emp_name emp #, total_days days, col3, col4 from table

    Here, I need to display a link beside the example of days

    If day > 100 then display "101 CH" where 101 days value and CH is the URL link which will open a popup page. I can't have another column for the link that we have already several columns. So I need a way to display the link with the value next to him. How can I achieve this?

    try to put it in the source of the region

    Select emp_name, emp #,.

    -case when days > 100 then days | " http://Google.com" target = "_blank" > popup' another to_char (days) end total_days, "

    col3, col4 from table;

    This should display "101 popup" when the days more than 100, no popup link on days<= 100="" e,g="" "99"="">

    and the value of the column total_days to the "Reporting Standard column" to allow html tags.

    Change the href attribute and formatting to meet your requirement

  • Excellent loading from data / last copy takes all the data from column to single column

    I use oracle apex apex.oraclecorp.com, I set up a new page to load data for one of the table Simple (with 4 column of numeric values and varchar 1) Ex: component (VARCHAR), Q1 and Q2 & Q3 and Q4 are (NUMBER) based in columns

    In the CSV, I gave the data like this when I move the CSV file on the page "under data source to load', click Next

    COMPONENT1ST QUARTER1ST QUARTERQ3Q4
    ABCD100200300400
    DCBA90807060

    I see all the data IS SHOWN IN THE single COLUMN: PFA screenshot

    I also tried with packaged Application: "loading samples" there in the same way

    Please let me know if I m missing something

    Thank you

    CHS

    Hello

    Looks like you need to specify the right column delimiter (comma, tab, etc.). Check which delimiter is used in your csv and make sure that you specify in the field "separator".

    Kind regards

    Vincent

    http://vincentdeelen.blogspot.com

  • Merge two column in single column value

    Team,

    I have a requirement where in I need to merge 2 column values in a single column.

    e.g. I Percent_complete column in my table. and my table has only one record.

    I need to ask questions that I need to store the values of percent_complete and (100-percent_complete) in a single column.

    ex

    Percentage complete is set to 30.

    I need to select the 30 and 70 (100-30) both in a single column.

    Thank you

    If you mean like this?

    SQL > ed
    A written file afiedt.buf

    1 with t (select 30 as double percent_complete)
    2  --
    3 end of test data
    4  --
    5. Select decode(rownum,1,percent_complete,100-percent_complete) as percent_complete
    6 t
    7 * connect by rownum<=>
    SQL > /.

    PERCENT_COMPLETE
    ----------------
    30
    70

  • For all the records for each record double, I need to get a single column with null or 0.

    Hi all

    I have a requirement where I need to get all the records, for each record in double, I need to get a single column with null or 0.

    create table a1

    (

    Identification number,

    VARCHAR2 (100), the point

    part varchar2 (100));

    Insert into a1

    values (1, 'ABC', 'A1');

    Insert into a1

    values (2, 'DEF', 'A2');

    TABLE A

    PART ITEM ID

    1 ABC A1

    1 ABC A1

    1 ABC A1

    DEF 2 A2

    DEF 2 A2

    3 DEF A2

    O/P

    PART ITEM ID

    1 ABC A1

    1        ABC             0

    1        ABC             0

    DEF 2 A2

    2       DEF              0

    3       DEF              0

    Thanks in advance.

    Thanks for your help FrankKalush...

    This one will work.

    WITH got_r_num AS

    (

    SELECT NVL (a1.id, a1.id) as id

    NVL (a1.item, a1.item) AS element

    NVL (a1.part, a1.part) IN the framework

    a1.id AS a_id

    ROW_NUMBER () OVER (PARTITION BY a1.id

    ORDER BY NULL

    ) AS r_num

    BY the a1

    )

    SELECT id

    element

    CASE

    WHEN a_id IS NOT NULL

    AND r_num = 1

    THEN part

    ELSE ' 0'

    END in the framework

    OF got_r_num

    ;

  • function not returning object table properly

    Rather than return a table, my function returns this:

    SCHEMA_OWNER. TBL_SUMS ([SCHEMA_OWNER. SUMS_OBJ])

    Did anyone see a syntax error in my function or the DOF of my table and object types?

    It is a stripped down, simplified version of my function:

    create or replace FUNCTION "F_TEST" (number of p_skey, p_start_date date, p_end_date date)
    RETURN tbl_sums

    IS

    tmp_A NUMBER;
    tmp_B NUMBER;

    l_tbl tbl_sums: = tbl_sums();

    BEGIN

    SELECT SUM (FieldA), SUM (FieldB)
    in tmpA, tmpB
    FROM MaTable where SKEY = p_skey
    and DATE_VALUE > = p_start_date
    and DATE_VALUE < p_end_date;.

    l_tbl.extend;
    l_tbl (l_tbl. (Count()): = sums_obj (p_start_date, p_end_date, p_skey, tmpA, tmpB);
    Return l_tbl;

    END;

    My models are:

    create or replace type sums_obj is object (DATE start_date, end_date DATE, skey NUMBER, SumA, SumB NUMBER);
    create or replace type tbl_sums is table of the sums_obj;


    Thank you!

    >
    RETURN tbl_kpi
    >
    What is 'tbl_kpi '? Which is not defined anywhere. Your original post said:
    >
    RETURN tbl_sums
    >
    We cannot help you if you don't publish what you actually use. Cut & paste is ok, but you have to paste the correct code.

    Your function returns a TABLE, but it is NOT in the PIPELINE. For example, if you query the DOUBLE function you will get a DATASET as a result.

    If you query the function AS A TABLE, you will get the "content" of the table.

    If you make your function a PIPELINED function then you use PIPE ROW to return each line but the function is always declared to return a TABLE. This is perhaps what is confusing you.

    Try the following code to see what the difference is.

    Here are two SQL types based on the EMP table in the scott schema.

    -- type to match emp record
    create or replace type emp_scalar_type as object
      (EMPNO NUMBER(4) ,
       ENAME VARCHAR2(10),
       JOB VARCHAR2(9),
       MGR NUMBER(4),
       HIREDATE DATE,
       SAL NUMBER(7, 2),
       COMM NUMBER(7, 2),
       DEPTNO NUMBER(2)
      )
      /
    
    -- table of emp records
    create or replace type emp_table_type as table of emp_scalar_type
    /
    

    Now - here's a function (similar to yours) that returns him EMP_TABLE_TYPE. NOTE: the function IS NOT PIPELINED

    CREATE OR REPLACE function SCOTT.get_emp1( p_deptno in number )
      return emp_table_type
      as
    tb emp_table_type;
    BEGIN
      select emp_scalar_type(empno, ename, job, mgr, hiredate, sal, comm, deptno)
        bulk collect into tb from emp where deptno = p_deptno;
      return tb;
    end;
    /
    

    If I simply select the function itself twice I get this:

    select get_emp1(20) from dual
    
    GET_EMP1(20)
    (DATASET)
    

    I can use TOAD or sql developer to examine this dataset and see the documents.

    But I can actually query the records by using the TABLE function:

    select * from table(get_emp1(20))
    
    EMPNO     ENAME     JOB     MGR     HIREDATE     SAL     COMM     DEPTNO
    7369     SMITH     CLERK     7902     12/17/1980     800          20
    7566     JONES     MANAGER     7839     4/2/1981     2975          20
    7788     SCOTT     ANALYST     7566     4/19/1987     3000          20
    7876     ADAMS     CLERK     7788     5/23/1987     1100          20
    7902     FORD     ANALYST     7566     12/3/1981     3000          20
    

    This is a similar function. It returns the same EMP_TABLE_TYPE, but it is a PIPELINED function.

    -- pipelined function
    create or replace function get_emp( p_deptno in number )
      return emp_table_type
      PIPELINED
      as
       TYPE EmpCurTyp IS REF CURSOR RETURN emp%ROWTYPE;
        emp_cv EmpCurTyp;
        l_rec  emp%rowtype;
      begin
        open emp_cv for select * from emp where deptno = p_deptno;
        loop
          fetch emp_cv into l_rec;
          exit when (emp_cv%notfound);
          pipe row( emp_scalar_type( l_rec.empno, LOWER(l_rec.ename),
              l_rec.job, l_rec.mgr, l_rec.hiredate, l_rec.sal, l_rec.comm, l_rec.deptno ) );
        end loop;
        return;
      end;
      /
    

    The ONLY way I can query this function is using the TABLE function:

    select * from table(get_emp(20))
    
    EMPNO     ENAME     JOB     MGR     HIREDATE     SAL     COMM     DEPTNO
    7369     smith     CLERK     7902     12/17/1980     800          20
    7566     jones     MANAGER     7839     4/2/1981     2975          20
    7788     scott     ANALYST     7566     4/19/1987     3000          20
    7876     adams     CLERK     7788     5/23/1987     1100          20
    7902     ford     ANALYST     7566     12/3/1981     3000          20
    

    The query of the PIPELINED function is the same and the result set is the same.

    The difference is that the PIPELINED function returns ONE LINE at a time and does NOT need to accumulate a large amount of data in a collection before returning. This collection uses the memory of expensive PGA and the more data you have the more memory it uses.

    Your function (and my only similar) return NO data until it has produced ALL of this. And he uses this expensive PGA memory. What is the point to create your collection at a time line and wait until you have everything before send it back you?

    You can easily modify your function and add PIPELINED to the declaration. Then, use the PIPE ROW clause to return each row that it is produced. Which will eliminate the need of collecting (and memory) within the service.

    You can also then follow up calls to function if you need to.

    See 'Use of functions Table in pipeline and parallel' in the data cartridge Developer Guide
    http://docs.Oracle.com/CD/B28359_01/AppDev.111/b28425/pipe_paral_tbl.htm

    There is little use for your function that is not in the pipeline, but returns a type of table, unless you used to store the array type in a column of an object table.

    There are many uses for PIPELINED functions.

  • Convert lines to a single column

    Hi all


    Need help, I have a table where I want the output to a single column

    ex: Select in t1. *
    the query result_

    rownum col_1
    1 8217
    2 6037
    3-5368
    4 5543
    5 5232

    I want the result to be: * 8217,6037,5368,5543,5232 *.


    Thank you for your help in advance.

    I search the web but couldn't find a solution that is easily understandable.

    WM_CONCAT is not documented, so not everyone would want to use it in production code.
    However, SYS_CONNECT_BY_PATH might work:

    SQL> create table t as
      2  select 1 rn, 8217 count_1 from dual union
      3  select 2, 6037 from dual union
      4  select 3, 5368 from dual union
      5  select 4, 5543 from dual union
      6  select 5, 5232  from dual;
    
    Table created.
    
    SQL> select * from t;
    
           RN    COUNT_1
    --------- ----------
            1       8217
            2       6037
            3       5368
            4       5543
            5       5232
    
    5 rows selected.
    
    SQL>
    SQL> select rownum
      2  ,      ltrim(sys_connect_by_path(count_1, ','), ',') count_1
      3  from   t
      4  where  connect_by_isleaf=1
      5  start with t.rn=1
      6  connect by t.rn  = prior t.rn+1;
    
     ROWNUM
    -------
    COUNT_1
    -------------------------------------------------------------------------------------
          1
    8217,6037,5368,5543,5232
    
    1 row selected.
    

    Or LISTAGG on 11.2:

    SQL> select listagg(count_1, ',') within group (order by rn) agged from t;
    
    AGGED
    -------------------------
    8217,6037,5368,5543,5232
    
    1 row selected.
    

    I really hope that you do not really use ROWNUM as column name? I used instead RN...

Maybe you are looking for

  • How can I activate iPhone 6 flashlight in the iOS 10?

    After update to iOS 10, my iPhone 6 + a without a flashlight in the control panel. Is this a bug that will be fixed? Is the control of the flashlight elsewhere?

  • Satellite T100-107 - after update driver, I can't use Bluetooth

    Satellite T100-107/getting updated driver killing Bluetooth windows 7 64 bit running. Started toward the top of my new laptop, did all the microsoft and Toshiba updates and bluetooth does not work.So I did a reinstall of the hard drive to the top, di

  • Problems installing HP Deskjet 3940

    I have problems with the HP Deskjet 3940 installation, when I run Assistant installation what happens: The operating system on this computer is not supported. The installation cannot continue until this is resolved. Current OS: 601,00 Support: Window

  • Printer does not work. Update Windows drivers seem to be the cause of this.

    It is a recurring problem.  The printer stops working.  In the past, I tried to update the Windows driver, but it did not help.  I have uninstall the printer.  I reinstall the printer with my original disk, and everything works great... until this la

  • Problem with Windows Update after the removal of Virus

    My operating system is Win Vista 32 bit, had some virus closed my windows updates, have a view of the white page. Checked that my services and win update is in automatic mode has started, so I don't know why my updater gives me a red x saying windows