INSERT INTO... SELECT FROM XMLTABLE()

I'm trying to insert using a query to 11.2.0.3.  The table is defined as follows:

CREATE TABLE book_master AS TABLE OF XMLTYPE XMLTYPE STORE AS SECUREFILE BINARY;

The insert statement is structured in this way:

INSERT INTO book_master
SELECT
    t.invt_data
FROM
    XMLTable(
        XmlNamespaces('http://www.mrbook.com/InventoryData' AS "invtdata", 
                  'http://www.mrbook.com/book' AS "book"),  
        '/book:BOOKS'
    PASSING ?
    COLUMNS
         invt_data XMLTYPE PATH 'invtdata:INVT_DATA'
    ) t;

The parameter '?' is passed through JDBC.

When I run the present, I get the error:

Error report:
SQL Error: ORA-19010: Cannot insert XML fragments
19010. 00000 -  "Cannot insert XML fragments" 
*Cause:    XML fragments got from extractNode cannot be inserted into the database.
*Action:   Convert the fragment into a proper XML document before insertion.

Is it possible to cast the XMLTYPE returned by XMLTable in a comprehensive document, instead of a node?

Is it possible to cast the XMLTYPE returned by XMLTable in a comprehensive document, instead of a node?

Well, the error message is pretty clear: you are trying to insert fragments, not a document (only root of content). It is not allowed.

I guess that the query returns several items INVT_DATA, right?

SQL > INSERT INTO book_master

2. SELECT

3 t.invt_data

4

(5) XMLTable

6 ' / BOOKS»

7 PASSAGE xmltype ('"")

8 COLUMNS

9 invt_data XMLTYPE PATH 'INVT_DATA '.

(10) t;

INSERT INTO book_master

*

ERROR on line 1:

ORA-19010: cannot insert XML fragments

We must build a document by encapsulating the fragments returned in a single root element.

Tags: Database

Similar Questions

  • Insert into select * from table 3. -is on the agenda by the needless?

    I've got an example of script, it will work for any table, so I don't bother with the full ddl.

    ----------------------------------------------------------------------------
    create table test in select * from hotels where 1 = 2;

    Insert into test select * from Hotels by city;

    Select the city from the trial;

    -drop table test is serving;
    -----------------------------------------------------------------------------

    The amazing thing is, that the city is ordered alphabetically,
    but you would say it is that an operation order is irrelevant.

    Any ideas on that?

    This will still work?

    Edited by: FourEyes on December 8, 2008 22:55

    Edited by: FourEyes on 8 December 2008 22:56

    Edited by: FourEyes on 8 December 2008 22:56

    Hello

    The [SQL Oracle 10 language reference | http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_9014.htm#sthref9371] manual says:

    «In regards to the ORDER BY clause from the subquery in the DML_table_expression_clause, you place your order is guaranteed only for the inserted rows and only within each extension table.» Orders new lines with regard to existing lines is not guaranteed. »

  • Insert into table1 from table1

    Hello

    I tried to insert into table - from select col1, col2, col3 from table b where
    Table - b.change_dt between 't1d' and 'T2D.

    can someone help me with the query

    Thank you
    insert into table-A from select col1,col2,col3 from table-b where
    table-b.change_dt between 'dt1' and 'dt2'
    

    you have an additional 'from', so it will be:

    insert into table-A(col1,col2,col3) (select col1, col2, col3 from table b where)
    Table - b.change_dt between 't1d' and "T2D")

    Please, close your threads, try to clean up the forum.

  • issue: sql insert into select

    which is wrong with this query?

    insert into m_payment_option (p_type, m_fulfillment)

    values ('DIRECT_DEBIT', (select id from M_FULFILLMENT whose id not in (select m_fulfillment from M_PAYMENT_OPTION)));

    SQL-Fehler: ORA-01427: Unterabfrage fur eine liefert mehr als eine line line

    01427 00000 - "einreihig subquery returns several lines.

    the subquery returns:

    SELECT id from M_FULFILLMENT whose id not in (select m_fulfillment from M_PAYMENT_OPTION)

    47113

    47182

    47183

    ..

    Hallo,

    Try this

    insert into m_payment_option (p_type,m_fulfillment)
    select 'DIRECT_DEBIT', id from M_FULFILLMENT  where id not in (select m_fulfillment from M_PAYMENT_OPTION));
    

    The subquery in your statement offers several lines and failed to insert 2 or more values in your m_fulfillment column at a time.

    But I think you want to insert several lines. Otherwise, you need to change your subquery to offer that one value, maybe a max or min function will help.

    Grüße aus Bonn

    Kay

  • CAPTURE THE OUTPUT IN INSERT INTO SELECT AND DELETE

    Hi all


    INSERT into employee_history_arch select * from employee_history where employee_status = 'CP' and action_dt < (sysdate-32);
    commit;

    delete from employee_history where employee_status = 'CP' and action_dt < (sysdate-32);
    commit;

    I must capture both the output of the insert and delete the sql query and compare the two values for validation. I shouldn't use select count (*) before the delete statement. I shud exactly capture the output... How to do? Please help me

    We will have ' 30 deleted rows' or ' 30 inserted rows"in our tool... I need to capture that 'put out' in a variable and validate against the other

    This should be easy.

    SQL> set serverout on
    SQL> DECLARE
      2    v_rows_inserted PLS_INTEGER;
      3    v_rows_deleted  PLS_INTEGER;
      4  BEGIN
      5    INSERT INTO emp_temp
      6      SELECT * FROM emp WHERE deptno = 20;
      7    v_rows_inserted := SQL%ROWCOUNT;
      8    dbms_output.put_line('Rows Inserted: ' || v_rows_inserted);
      9    DELETE FROM EMP WHERE deptno = 20;
     10    v_rows_deleted := SQL%ROWCOUNT;
     11    dbms_output.put_line('Rows Deleted: ' || v_rows_deleted);
     12    IF v_rows_inserted = v_rows_deleted THEN
     13      dbms_output.put_line('They are same!');
     14    ELSE
     15      dbms_output.put_line('They are NOT same!');
     16    END IF;
     17  END;
     18  /
    Rows Inserted: 7
    Rows Deleted: 7
    They are same!
    
    PL/SQL procedure successfully completed.
    
  • Function of package of call per line in the statement INSERT INTO SELECT

    Hello

    I wrote the following SQL insert.

    INSERT the Table_A (Col_A, Col_B, Col_C)

    SELECT Col_A, Col_B, (SELECT PACKAGE1. DOUBLE FUNC())

    FROM Table_A

    WHERE Col_A = "AAA".

    PACKAGE1. Func() is a function to create numbers using the sequence.

    The result is

    Col_a Col_B, Col_C

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

    C003 AAA B1

    C003 AAA B2
    C003 AAA B3

    What I want is as follows:

    Col_a Col_B, Col_C

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

    C003 AAA B1

    AAA B2 C004
    AAA B3 C005

    I want different values per line in Col_C. is it possible to do this?

    I think the fact that you put the function call in a subquery is why he executed only once (which is a useful thing to know if you want this feature). To get executed for each line, you only need to do this:

    INSERT the Table_A (Col_A, Col_B, Col_C)

    SELECT Col_A, Col_B, PACKAGE1. FUNC()

    FROM Table_A

    WHERE Col_A = "AAA".

    However, as others have said, there is no reason to wrap a sequence.nextval in a function.

  • Long time, buffer with an insert and select through a dblink

    I do a fairly simple ' insert into select from "statement through a dblink, but something is seriously wrong across the link. I am a huge buffer time in terms of the command explain (line 9) and I don't know why. When I try to run sql tuning on it across the dblink, I get an ora-600 error "ORA-24327: need explicit attach before authenticating a user.
    Here's the original sql:

    INSERT INTO PACE_IR_MOISTURE@PRODDMT00 (SCHEDULE_SEQ, LAB_SAMPLE_ID, HSN, SAMPLE_TYPE, MATRIX, SYSTEM_ID)
    SELECT DISTINCT S.SCHEDULE_SEQ, PI. LAB_SAMPLE_ID, PI. HSN, SAM. SAMPLE_TYPE, SAM. MATRIX: B1 S SCHEDULES
    JOIN THE PERMANENT_IDS ' X '. HSN = S.SCHEDULE_ID
    JOIN SAM SAMPLES WE PI. HSN = SAM. HSN
    JOIN PROJECT_SAMPLES ON PS PS. HSN = SAM. HSN
    JOIN PROJECTS P ON PS. PROJECT_SEQ = PS. PROJECT_SEQ
    WHERE S.PROC_CODE = 'DRY WEIGHT' AND S.ACTIVE_FLAG = 'C' AND S.COND_CODE = 'CH' AND P.WIP_STATUS IN ('WP', 'HO')
    AND SAM. WIP_STATUS = "WP";

    Here's the sql code, as it appears on proddmt00:

    INSERT INTO 'PACE_IR_MOISTURE' ('SCHEDULE_SEQ', 'LAB_SAMPLE_ID', 'HSN","SAMPLE_TYPE","MATRIX","SYSTEM_ID")
    SELECT 'A6' DISTINCT '. SCHEDULE_SEQ', 'A5 '. "' LAB_SAMPLE_ID ', 'A5 '. "" HSN ","A4 ". "" SAMPLE_TYPE ","A4 ". "" MATRIX ": B1
    "SCHEDULES" @! "A6", "PERMANENT_IDS" @! "A5", "SAMPLES" @! "A4", "PROJECT_SAMPLES" @! "A3", "PROJECTS" @! "A2".
    WHERE "A6". «PROC_CODE ' = 'DRY WEIGHT' AND 'A6'.» ' ACTIVE_FLAG '= 'C' AND "A6". "COND_CODE" = "CH", ("A2" ".") " WIP_STATUS '= 'WP' OR 'A2'.' WIP_STATUS "=" HO") AND"A4 ". "WIP_STATUS"= "WP" AND "A3". "PROJECT_SEQ"= "A3". "" PROJECT_SEQ "AND"A3 ". "HSN"= "A4". "" HSN ' AND 'A5 '. "HSN"= "A4". "" HSN ' AND 'A5 '. "HSN"= "A6". "" SCHEDULE_ID. "

    Here is the plan of the command explain on proddmt00:

    PLAN_TABLE_OUTPUT
    ------------------------------------------------------------------------------------------------------------------------------------------------------
    SQL_ID, cvgpfkhdhn835, number of children 0
    -------------------------------------
    INSERT INTO 'PACE_IR_MOISTURE' ('SCHEDULE_SEQ', 'LAB_SAMPLE_ID', 'HSN","SAMPLE_TYPE","MATRIX","SYSTEM_ID")
    SELECT 'A6' DISTINCT '. SCHEDULE_SEQ', 'A5 '. "' LAB_SAMPLE_ID ', 'A5 '. "" HSN ","A4 ". "" SAMPLE_TYPE ","A4 ". "" MATRIX ": B1
    "SCHEDULES" @! "A6", "PERMANENT_IDS" @! "A5", "SAMPLES" @! "A4", "PROJECT_SAMPLES" @! "A3", "PROJECTS" @! "A2".
    WHERE "A6". «PROC_CODE ' = 'DRY WEIGHT' AND 'A6'.» ' ACTIVE_FLAG '= 'C' AND "A6". "COND_CODE" = "CH" AND "
    ("A2". "WIP_STATUS"= "WP" OR "A2". ("" WIP_STATUS "=" HO ") AND"A4 ". "WIP_STATUS" = "WP" AND "
    "A3". "PROJECT_SEQ"= "A3". "" PROJECT_SEQ "AND"A3 ". "HSN"= "A4". "" HSN ' AND 'A5 '. "HSN"= "A4". "" HSN "AND
    'A5 '. "HSN"= "A6". "" SCHEDULE_ID. "

    Hash value of plan: 3310593411

    -------------------------------------------------------------------------------------------------------------------
    | ID | Operation | Name | Lines | Bytes | TempSpc | Cost (% CPU). Time | Inst | IN-OUT |
    -------------------------------------------------------------------------------------------------------------------
    | 0 | INSERT STATEMENT. 5426M (100) | |
    | 1. UNIQUE HASH | 1210K | 118 M | 262 M | 5426M (3) | 999:59:59 |
    |* 2 | HASH JOIN | 763G | 54T | 8152K | 4300M (1) | 999:59:59 |
    | 3. DISTANCE | 231K | 5429K | 3389 (2) | 00:00:41 |! | R > S |
    | 4. THE CARTESIAN MERGE JOIN. 1254G | 61T | 1361M (74). 999:59:59 |
    | 5. THE CARTESIAN MERGE JOIN. 3297K | 128 M | 22869 (5) | 00:04:35 |
    | 4 > DISTANCE | SCHEDULES | 79. 3002 | 75 (0) | 00:00:01 | | R > S |
    | 7. KIND OF BUFFER. 41830 | 122K | 22794 (5) | 00:04:34 |
    | 8. DISTANCE | PROJECTS | 41830 | 122K | 281 (2) | 00:00:04 |! | R > S |
    | 9. KIND OF BUFFER. 380K | 4828K | 1361M (74). 999:59:59 |
    | 10. DISTANCE | PROJECT_SAMPLES | 380K | 4828K | 111 (0) | 00:00:02 |! | R > S |
    -------------------------------------------------------------------------------------------------------------------

    Information of predicates (identified by the operation identity card):
    ---------------------------------------------------

    2 - access("A3".") HSN '= 'A4'.' HSN' AND 'A5 '. "HSN"= "A6". ("' SCHEDULE_ID")

    Hello

    Looking at your SQL it loks like you're not joining to the PROJECT table (where the word dreaded CARTESIAN?):

    Your code:

    JOIN PROJECTS P ON PS.PROJECT_SEQ = PS.PROJECT_SEQ 
    

    ... I think this should probably be...

    JOIN PROJECTS P ON P.PROJECT_SEQ = PS.PROJECT_SEQ 
    

    ....??

  • Insert into MDQ_OLD select * from table (lt_monitorMdq);

    I'm trying to insert into a table that has only a single column, which is a column of a user defined type (UDT). The UDT is nested, that is one of the attributes of the UDT is an another UDT.

    I aim to insert into the table like this pseudo-code:

    INSERT INTO T1 SELECT * FROM THE UDT;

    CREATE TABLE MDQ_OLD (myMDQ UDT_T_MONITOR_MDQ)

    NESTED TABLE myMDQ

    (T1_NEW) ACE STORE

    THE NESTED TABLE MONITOR_MDQ_PRIM_RIGHTS

    STORE AS T2_NEW);

    The MONITOR_MDQ_CLI procedure. Read below returns the parameter lt_monitorMdq which is a UDT type as announced. The statement "insert into select MDQ_OLD * table (lt_monitorMdq);" fails, while the second insert statement works.

    Is it possible to get the first statement of work?

    I'm on Oracle 11 g 2.

    DECLARE

    lt_monitorMdq UDT_T_MONITOR_MDQ;

    BEGIN

    MONITOR_MDQ_CLI. Reading (TRUNC (SYSDATE),

    TRUNC (SYSDATE),

    NULL,

    NULL,

    "MILLION BTU.

    lt_monitorMdq); -Note lt_monitorMdq is an OUT parameter

    -This insert does not work

    Insert into MDQ_OLD select * from table (lt_monitorMdq);

    BECAUSE me in 1... lt_monitorMdq.count

    LOOP

    Dbms_output.put_line ('lt_monitorMdq: ' | .mdq_id lt_monitorMdq (i));

    -This integration works

    INSERT INTO MDQ_OLD (MYMDQ)

    VALUES (UDT_T_MONITOR_MDQ (UDT_R_MONITOR_MDQ)

    lt_monitorMdq (i) .gasday,

    1,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    () UDT_T_MONITOR_MDQ_PRIM_RIGHT

    () UDT_R_MONITOR_MDQ_PRIM_RIGHT

    1,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    (NULL)));

    END LOOP;

    END;

    have you tried:

    INSERT INTO MDQ_OLD (myMDQ) VALUES (lt_MonditorMDq);

    curiosity:

    Is there a particular reason, why you have created a table with a single column of type UDT instead of:

    CREATE TABLE... OF UDT_T_MONITOR_MDQ;

    I can tell you from experience that using a nested table, you can easily query the data in the nested table.

    MK

  • Support for mandatory request - insert, select from the same table

    Hi all

    I need your help to write queries effectively.
    Oracle Version: 10.2.0.3.0
    OPERATING SYSTEM: UNIX

    I have a METRICS_TBL that is mentioned below table.

    CYCLE_DATE METRIC VALUE
    08/17/2008 COST-TV 100
    08/17/2008 COST-JOURNAL 50
    08/17/2008 COST-POSTALMAIL 25
    08/17/2008-PROD-TV 10
    08/17/2008-PROD-JOURNAL 25
    08/17/2008-PROD-POSTALMAIL 5

    Any data above, I have to add (Insert into select METRICS_TBL METRICS_TBL) at the same table with the records as mentioned below.

    2008-08-17 COSTPERPROD-TV 10
    08/17/2008-COSTPERPROD-LOG 2
    2008-08-17 COST PROD-POSTALMAIL 5

    Basically, I need to calculate the cost per product for each category. Depending on the settings available, metric should also be changed as COSTPERPROD and values should be cost/prod under each category.

    Can someone help me with the query.

    Thank you

    Something like this:

    INSERT INTO metrics_tbl
    (cycle_date, metrics, value)
    SELECT cost.cycle_date
             , 'COSTPERPROD-'||cost.mtype
             ,cost.value / prod.value
    FROM  (
       select cycle_date,substr(metrics, 1, 4) mtype, substrmetrics,instr(metrics,'-')+1) mmetric
       where substr(metrics, 1, 4) = 'PROD'
       ) prod
    INNER JOIN (   select cycle_date,substr(metrics, 1, 4) mtype, substrmetrics,instr(metrics,'-')+1) mmetric
       where substr(metrics, 1, 4) = 'COST'
       ) cost on cost.cycle_date = prod.cycle_date and cost.mmetric = prod.mmetric
    

    Ideally you would divide your METRICS column into two: one for the thing you're measuring (e.g. TV or NEWSPAPER) and the other for the metric (COST, PROD, COSTPERPROD etc.). That's what I did in the views online. Without it, it's kinda a mess and behave so, if the table becomes much more.

    HTH

    Nigel cordially

    Edited by: nthomas on January 14, 2009 15:57 - small correction SQL

  • Exception No_data_found to insert into... select statement

    Hai,
    I have a doubt in plsql exceptions. In the sub program mentioned plsql.

    Start

    insert into select abc * xyz a, b of cdf where a.c1 = b.c2;

    exception
    When no_data_found then
    do some operations

    end;

    In the pl/sql block above, if the select statement returns no rows, whether or not the exception is triggered? If not, how do the same. Any available alternative.

    Thanks in advance.

    Concerning
    Sridhar

    You would get an error no_data_found triggered at that time there, because it's perfectly valid to insert rows 0.

    You will need to check SQL ROWCOUNT % and raise the no_data_found if it is equal to 0.

  • Insert XML data from the Table-&gt; back to null

    Dear Experts,

    -I have table xml as below:

    Example of CREATE TABLE (XML_spec XMLTYPE);

    Insert in the example
    Select ' < name of Message = "dataStaticInvestor" type = "IncomingMessage" >
    < name of field = "batchReference" > OPENINGBATCH000000 < / field > < List name = "data" >
    < = record name "data" >
    < name of field = "externalReference" > 01234567890aaaaaaa < / field >
    < name of field = "participantID" > OD001 < / field >
    < name of field = "participantName" > EQUITY SECURITIES INDONESIA, PT < / field >
    < / recording >
    < = record name "data" >
    < name of field = "externalReference" > 01234567890aaaaaaa < / field >
    < name of field = "participantID" > OD001 < / field >
    < name of field = "participantName" > EQUITY SECURITIES INDONESIA, PT < / field >
    < / recording >
    < = record name "data" >
    < name of field = "externalReference" > 01234567890aaaaaaa < / field >
    < name of field = "participantID" > OD001 < / field >
    < name of field = "participantName" > EQUITY SECURITIES INDONESIA, PT < / field >
    < / recording >
    < / list >
    < / message > ' double.

    Select * example;

    create table hasil1 (c1 varchar2 (500), c2 varchar2 (500), c3 varchar2 (500));

    -This step I create the procedure to insert xml data into the table as the batch.

    DECLARE
    x XmlType;
    BEGIN
    Select XML_SPEC in x for example;

    insert into hasil1
    SELECT
    p.Extract('/Record/Field/@externalReference').getstringval (C1),
    p.Extract('/Record/Field/@participantID').getstringval (C2),
    p.Extract('/Record/Field/@participantName').getstringval () as c3
    TABLE (XMLSequence (Extract(x,'Message/List/Record'))) p;
    commit;
    END;
    /

    -when the result of select hasil1, the output is back 3 rows and 3 columns, but all data is a null *.

    Best regards
    Sigcle

    You don't explain what output you need, but I guess something like this:

    SQL> insert into hasil1 (c1, c2, c3)
      2  select x.c1, x.c2, x.c3
      3  from example t
      4     , xmltable(
      5         'Message/List/Record'
      6         passing t.xml_spec
      7         columns c1 varchar2(500) path 'Field[@name="externalReference"]'
      8               , c2 varchar2(500) path 'Field[@name="participantID"]'
      9               , c3 varchar2(500) path 'Field[@name="participantName"]'
     10       ) x
     11  ;
    
    3 rows inserted
    
    SQL> select * from hasil1;
    
    C1                     C2        C3
    ---------------------- --------- --------------------------------
    01234567890aaaaaaa     OD001     EQUITY SECURITIES INDONESIA,PT
    01234567890aaaaaaa     OD001     EQUITY SECURITIES INDONESIA,PT
    01234567890aaaaaaa     OD001     EQUITY SECURITIES INDONESIA,PT
     
    
  • missing parenthesis in insertion into separate lines select the table from the other table

    Hello

    could you help me with the following question?

    I have the following tables

    CREATE TABLE table1)

    ID varchar (12),

    col2 varchar (10),

    COL3 varchar (10),

    level varchar (10))

    CREATE TABLE table2)

    Id2 varchar (12)

    A varchar (10),

    B number (1)

    CONSTRAINT PRIMARY KEY PK (ID2, is));

    INSERT INTO table2 (ID2, A, B) SELECT ID, col2

    MAX (CASE WHEN level = "level 1" then 1

    level = 'level 2' then 2

    Level = 3 then 'niveau3') as colIN3)

    FROM table1 GROUP BY ID2, a.;

    the first table have duplicates as follows:

    Id2 COL2 COL3 level

    A1 pepe football level1

    A1 pepe football level2

    A1 pepe football level1

    A1 pepe basket level2

    A1 pepe pingpong level3

    the output should be selected with unique key (ID2, col3) lines and the level must be the greatest.

    Id2 COL2 COL3 level

    A1 pepe football level2

    A1 pepe basket level2

    A1 pepe pingpong level3

    The output of the script tells me the following messages:

    -lack of right parenthesis referring to the max function.

    Thanks adavance.

    Kind regards

    Hello

    Remember the ABC's of the GROUP BY:

    When you use a GROUP BY clause or in an aggregate function, then all in the SELECT clause must be:

    (A) a ggregate function,

    (B) one of the expressions "group By."

    (C) adding to C, or

    (D) something that Depends on the foregoing.  (For example, if you "GROUP BY TRUNC (dt)", you can SELECT "TO_CHAR (TRUNC (dt), 'Mon - DD')").

    To ask him, there are 5 columns in the SELECT clause.  The last one is a function MAX (...); It is an aggregate, is not serious.

    The first 2 columns are also named in the GROUP BY clause, so that they are well.

    The other 2 columns, country and internal_Id do not match any of the above categories.  These 2 columns cause the error.

    There are many ways to avoid this error, each producing different results.  You could

    • remove these 2 columns in the SELECT clause
    • Add these 2 columns in the GROUP BY clause
    • use the aggregation such as MIN, 2-column functions
    • remove the country from the SELECT clause and add internal_id to the GROUP BY clause
    • remove the internal_id from the SELECT clause, and add countries to the GROUP BY clause
    • ...

    What are the results you want?

    Whenever you have a question, please post a small example of data (CREATE TABLE and INSERT statements) for all the tables involved, so people who want to help you can recreate the problem and test their ideas.  Also post the results you want from this data, as well as an explanation of how you get these results from these data.

    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: https://forums.oracle.com/message/9362002

  • Select values from the db1 table and insert into the DB2 table

    Hello

    I have three databases oracle running in three different machines. their ip address is different. among the DB can access databases. (means am able to select values and insert values into tables individually.)

    I need to extract data from the DB1 table (ip say DB1 is 10.10.10.10 and the user is DB1user and the table is DB1user_table) and insert the values into DB2 table (say ip DB2 is 11.11.11.11 and the user is DB2user and table DB2user_table) of DB3 that is to have access to the two IPs DB.

    How do I do this

    Edited by: Aemunathan on February 10, 2010 23:12

    Depending on the amount of data must be moved between DB1 and DB2, and the frequency at which this should happen, you might consider the SQL * COPY more control. I think it's very useful for one-off tasks little, so I can live within its limits of the data type. More http://download.oracle.com/docs/cd/E11882_01/server.112/e10823/apb.htm#i641251.

    Change some parameter of sqlplus session are almost mandatory in order to get decent transfer rates. Tuning ARRAYSIZE and COPYCOMMIT can make a huge difference in flow. LONG change may be necessary, too, depending on your data. The documentation offers these notes on use:

    To activate the copy of data between Oracle and databases non-Oracle, NUMBER of columns is replaced by DECIMAL columns in the destination table. Therefore, if you are copying between Oracle databases, a NUMBER column with no precision will become a DECIMAL column (38). When copying between Oracle databases, you must use SQL commands (CREATE TABLE AS and INSERTION), or you must make sure that your columns have a specified precision.

    SQL * the VALUE LONGER variable limits the length of the LONG column you are copying. If all LONG columns contain data exceeds the value of LONG, COPY truncates the data.

    SQL * Plus performs a validation at the end of each successful COPY. If you set the SQL * variable more COPYCOMMIT DEFINED to a value positive n, SQL * Plus performs a validation after copying all lots n of records. The SQL * Plus ARRAYSIZE variable SET determines the size of a batch.

    Some operating environments require that the service names be placed between double quotes.

    From a SQL * Plus term on DB3, can resemble the command to move all content from my_table in DB1 to the same table in DB2

    COPY from user1/pass1@DB1 to user2/pass2@DB2 -
    INSERT INTO my_table -
    USING select * from my_table
    

    Note the SQL code * more line-continuation character ' - '. It is used to escape the newline character in a SQL * Plus command if you do not have to type all on one line. I use it all the time with this command, but I can't locate the documentation on that right now. Maybe someone else can put their finger on it.

    There are other ways to accomplish what the command copy and it is not without its quirks and limitations, but I find that there is usefulness in an Oracle Toolbox.

  • Problem in «Insert into...» "Select * from tablename" query

    Hello
    I am inserting a million record from one table to another table using "insert in...". Select * from 'method. During this insertion, if one of the recording have insertion any problem then obiviously, be rollbacked, - not only that, to find the wrong people, the recording will be a tedious job.

    is it possible to find which record having problems during such an insertion? and is it possible to validate the transaction?

    Note: I know that we can use the collection method in bulk to solve this problem, but my situation, I have to use "insert..." Select * from 'method only.

    Please guide me if anyone have dealt with this problem before.

    Thank you
    Kalanidhi

    You can try the ERROR LOG IN the clause of the INSERT statement.

  • "missing the SELECT keyword" error during an insert into the temporary table using the blob value

    I'm trying to insert into an oracle temp table using select that retrieves data from a blob field but I get the error: "lack the SELECT keyword.

    How we store temporary in oracle result when we make this type of operation (extraction of data in fields and try to load them into a separate table on the fly.?)

    with cte as)

    Select user_id, utl_raw.cast_to_varchar2 (dbms_lob.substr (PREFERENCES)) as USER my_blob

    )

    create table new_table as

    SELECT user_id,EXTRACTvalue(xmltype(e.my_blob),'/preferences/locale') regional settings

    E ETC

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

    BLOB data - value - which is

    <? XML version = "1.0" encoding = "ISO-8859-1" ?>

    - < Preferences >

    < time zone > America/New_York < / > zone

    < displayscheduleinusertimezone > Y < / displayscheduleinusertimezone >

    < local > Spanish < /locale >

    < DateFormat > JJ/mm/aaaa < / DateFormat >

    < timeFormat > hh: mm aaa < / timeFormat >

    < longformat > Long_01 < / longformat >

    < doubleformat > Double_01 < / doubleformat >

    < percentformat > Percentage_01 < / percentformat >

    < currencyformat > Currency_01 < / currencyformat >

    < / Preferences >

    A WITH clause that must immediately precede the SELECT keyword:

    SQL > create table t:

    2 with the o as (select double dummy)

    3 select * West longitude;

    Table created.

Maybe you are looking for

  • Presario CQ 57-339wm: no sound from speakers, Driver date, don't watch working properly?

    My Compaq Presario CQ57-339WM running 64-bit Windows 7 has no sound coming from the built-in speakers.  The headphone jack works with headphones, but the built-in speakers have no sound.  I just downloaded the driver update and still no sound.  When

  • Pavilion dv7-6157nr: computer won't recognize 6770M

    Recently, while I was using my laptop I noticed that Catalyst Control Center has been the opening is no longer and I could not move from an integrated and dedicated graphics more. Being very intrigued, I decided to try to reinstall the graphics drive

  • Why cities xl usually install on my windows 7

    I brought cities xl and a window pops up so I can install it, I clicked and I click on the install window but it just disappears!

  • I lost the product key, where can I find?

    Hello, I have an age of Mythology game and I wanted to download it on my other laptop, but it asks for the product key. I don't have the box for almost 4 or 5 years. I figured since she was allowed, possessed, or anything else I could find here. I ca

  • Microsoft Paint suddenly cannot be found/used

    Here's the deal; This pc is about a year and a half, things worked very well on that. About 1 month ago I went to use Paint in the drop-down list in the Windows Photo Gallery (he was always there with reliability, a single click and it would always a