I need help on bulk inserts....

Hello,
I need help on bulk inserts. I have heard about it but don't know how to do it and how to specify the number of records to be inserted at a time.
Can anyone please help me out?
For example: I would like to insert in my TEST_TABLE a group of data at tha same time...
INSERT INTO TEST_TABLE VALUES ( (1, 'xxx', 'www'), (2, 'yyy', 'hhh'), (3, 'aaa', 'kkk') )
I using Oracle 10g .
Tks!!
Message was edited by:
user532944
Message was edited by:
user532944

But I want to insert a group of data at the same time, with one sql instruction...
I don´t know if exists this SQL command...I just know that I can insert
string sqlStmt = "INSERT INTO TESTE VALUES (:x, :x, :x)";
stmt = con->createStatement (sqlStmt);
But and this instruction ?? In MYSql I can do it!!
string sqlStmt = "INSERT INTO TESTE VALUES ((:x, :x, :x), (:x, :x, :x));
Message was edited by:
user532944

Similar Messages

  • Help with BULK Insert

    Hello SQL Buddies,
    I am trying to run a BULK insert.
    Here is my code:
    Code start:
    use Lagerliste
    drop table Import
    use Lagerliste
    create table Import
    TOTALQTY float null,
    PARTNO nvarchar (255) null,
    [DESC] nvarchar (255) null,
    CO nvarchar (255) null,
    BIN nvarchar (255) null,
    PRICE float null,
    DISCOUNT nvarchar (255) null,
    LASTPURC nvarchar (255) null,
    AGECODE nvarchar (255) null,
    MANFPART nvarchar (255) null
    use Lagerliste
    bulk
    insert Import
    from 'D:\FTP\RG\Stockfile.csv'
    with
    formatfile = 'D:\FormatFile\test.xml',
    Errorfile = 'D:\FormatFile\error.txt'
    Code stop..
    My format file code is here:
    Code start:
    <?xml version="1.0"?>
      <BCPFORMAT xmlns = "http://schemas.microsoft.com/sqlserver/2004/bulkload/format"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <RECORD>
          <FIELD ID="1"    xsi:type="CharTerm"        TERMINATOR= ',"'    />
          <FIELD ID="2"    xsi:type="CharTerm"    MAX_LENGTH="255"    TERMINATOR= '","' />
          <FIELD ID="3"    xsi:type="CharTerm"    MAX_LENGTH="255"    TERMINATOR= '","'    />
          <FIELD ID="4"    xsi:type="CharTerm"    MAX_LENGTH="255"    TERMINATOR= '","'    />
          <FIELD ID="5"    xsi:type="CharTerm"    MAX_LENGTH="255"    TERMINATOR= '",'    />
          <FIELD ID="6"    xsi:type="CharTerm"      TERMINATOR= ',"'    />
          <FIELD ID="7"    xsi:type="CharTerm"    MAX_LENGTH="255"    TERMINATOR= '","'    />
          <FIELD ID="8"    xsi:type="CharTerm"    MAX_LENGTH="255"    TERMINATOR= '","'    />
          <FIELD ID="9"    xsi:type="CharTerm"    MAX_LENGTH="255"    TERMINATOR= '","'    />
          <FIELD ID="10"    xsi:type="CharTerm"    MAX_LENGTH="255"    TERMINATOR= '"'        />
        </RECORD>
        <ROW>
          <COLUMN SOURCE="1" NAME="TOTALQTY"    xsi:type="SQLFLT8"/>
          <COLUMN SOURCE="2" NAME="PARTNO"    xsi:type="SQLNVARCHAR"/>
          <COLUMN SOURCE="3" NAME="DESC"        xsi:type="SQLNVARCHAR"/>
          <COLUMN SOURCE="4" NAME="CO"        xsi:type="SQLNVARCHAR"/>
          <COLUMN SOURCE="5" NAME="BIN"        xsi:type="SQLNVARCHAR"/>
          <COLUMN SOURCE="6" NAME="PRICE"        xsi:type="SQLFLT8"/>
          <COLUMN SOURCE="7" NAME="DISCOUNT"    xsi:type="SQLNVARCHAR"/>
          <COLUMN SOURCE="8" NAME="LASTPURC"    xsi:type="SQLNVARCHAR"/>
          <COLUMN SOURCE="9" NAME="AGECODE"    xsi:type="SQLNVARCHAR"/>
          <COLUMN SOURCE="10" NAME="MANFPART"    xsi:type="SQLNVARCHAR"/>
        </ROW>
      </BCPFORMAT>
    Code stop..
    If i run the code it says:
    Msg 4832, Level 16, State 1, Line 20
    Bulk load: An unexpected end of file was encountered in the data file.
    Msg 7399, Level 16, State 1, Line 20
    The OLE DB provider "BULK" for linked server "(null)" reported an error. The provider did not give any information about the error.
    Msg 7330, Level 16, State 2, Line 20
    Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".
    And the error file says:
    Row 473629 File Offset 42503226 ErrorFile Offset 0 - HRESULT 0x80004005
    If i then in my bulk insert adds: "Lastrow = '473629' it works all fine. So it will mean that it gets an error at the last line where there is no more data? But this sql query should run every day, so i have to do so it dont gets the error.
    Can someone help me?
    Looking forward to an answer, i hope someone have a solution.
    Regards Christian.

    Try the below format file,
    <?xml version="1.0"?>
    <BCPFORMAT xmlns = "http://schemas.microsoft.com/sqlserver/2004/bulkload/format"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <RECORD>
    <FIELD ID="1" xsi:type="CharTerm" TERMINATOR= ',"' />
    <FIELD ID="2" xsi:type="CharTerm" MAX_LENGTH="255" TERMINATOR= '","' />
    <FIELD ID="3" xsi:type="CharTerm" MAX_LENGTH="255" TERMINATOR= '","' />
    <FIELD ID="4" xsi:type="CharTerm" MAX_LENGTH="255" TERMINATOR= '","' />
    <FIELD ID="5" xsi:type="CharTerm" MAX_LENGTH="255" TERMINATOR= '",' />
    <FIELD ID="6" xsi:type="CharTerm" TERMINATOR= ',"' />
    <FIELD ID="7" xsi:type="CharTerm" MAX_LENGTH="255" TERMINATOR= '","' />
    <FIELD ID="8" xsi:type="CharTerm" MAX_LENGTH="255" TERMINATOR= '","' />
    <FIELD ID="9" xsi:type="CharTerm" MAX_LENGTH="255" TERMINATOR= '","' />
    <FIELD ID="10" xsi:type="CharTerm" MAX_LENGTH="255" TERMINATOR= '"\r\n' />
    </RECORD>
    <ROW>
    <COLUMN SOURCE="1" NAME="TOTALQTY" xsi:type="SQLFLT8"/>
    <COLUMN SOURCE="2" NAME="PARTNO" xsi:type="SQLNVARCHAR"/>
    <COLUMN SOURCE="3" NAME="DESC" xsi:type="SQLNVARCHAR"/>
    <COLUMN SOURCE="4" NAME="CO" xsi:type="SQLNVARCHAR"/>
    <COLUMN SOURCE="5" NAME="BIN" xsi:type="SQLNVARCHAR"/>
    <COLUMN SOURCE="6" NAME="PRICE" xsi:type="SQLFLT8"/>
    <COLUMN SOURCE="7" NAME="DISCOUNT" xsi:type="SQLNVARCHAR"/>
    <COLUMN SOURCE="8" NAME="LASTPURC" xsi:type="SQLNVARCHAR"/>
    <COLUMN SOURCE="9" NAME="AGECODE" xsi:type="SQLNVARCHAR"/>
    <COLUMN SOURCE="10" NAME="MANFPART" xsi:type="SQLNVARCHAR"/>
    </ROW>
    </BCPFORMAT>
    Refer
    http://stackoverflow.com/questions/8530353/sql-bulk-insert-xml-format-file-with-double-quotes-in-terminator
    http://technet.microsoft.com/en-us/library/ms191234(v=sql.105).aspx
    Regards, RSingh

  • Need help toUpdate or insert in to AS400 database

    Hi all,
    I have created one scenario in which I am using JDBC receiver adapter,
    now the database at the end which is to be updated is the AS400 database
    which has the concept of liabraries and staging tables.
    while mapping the Inbound message type I use the structure as
    <MT>
      <Statement>
           <Tablename>
                  action
                <access>
                      <field1>
                      <field2>
                <key>
    I assign a const. 'update_insert' to action attrib. but when I activate the adapter at the end the error I get is :
    'field1' column does not exists in 'Tablename'
    But when I use a JAVA code for doing the same the data is successfully updated on the database.
    I tried the same thing using MS Access database it works fine but not AS400
    need help.
    Thanks
    Ranjit

    Ranjith,
    The process is the very same for  AS400 too. We are doing operations with AS400 and we dint face any problems. Hope you have already deployed the JDBC drivers in your XI server.
    Change your Data type slightly.
    <MT>
    <Statement>
    <table action = UPDATE_INSERT>
    <table>specify the table name in library.table  name eg: LIBRARY.TABLE1</table>
    <access>
    <field1>a</field1>
    <field2>2</field2>
    <access>
    <key>
    <field1>a</field1>
    </key>
    </Statement>
    </MT>
    Regards,
    Jai Shankar

  • Need help in Bulk collect

    Hi All,
    I need a help to create a bulk statement. Please find the scenario below
    I would like to copy a table A from table B using bulk collect also the table A has more records (1Million). Before doing this I need to either truncate the table B or drop the table to load the data from table A.
    Please provide me the correct statement to achieve this request. Thanks in advance!!
    Regards,
    Boovan.

    disabling any indexes on the target should be looked at first. If there are none then look at the above.
    When you do a direct path load the indexes are build after loading.The point is that the direct path load does not avoid the undo due to the indexes.
    In this example on a table with no indexes the undo used goes from 216kb to 16kb using append.
    When an index is added the undo used goes up from 216kb to 704kb an increase of 488kb for a standard insert.
    For the direct path insert the undo goes up from 16kb to 440kb so almost the full amount of undo due to the index.
    So the presence of a single index can have a much greater impact on the amount of undo required than the use of a direct path load and that undo may not be avoided by the use of a direct path load unless the index is disabled beforehand.
    Also note the tiny amounts of undo we are talking about for 50k rows.
    SQL> create table t as select * from all_objects where 0 = 1;
    Table created.
    SQL> insert into t select * from all_objects;
    56108 rows created.
    SQL> select
      2      used_ublk undo_used_blk,
      3      used_ublk * blk_size_kb undo_used_kb,
      4      log_io logical_io,
      5      cr_get consistent_gets
      6  from
      7      v$transaction, v$session s,
      8      (select distinct sid from v$mystat) m,
      9      (select to_number(value)/1024 blk_size_kb
    10          from v$parameter where name='db_block_size')
    11  where
    12      m.sid       =   s.sid
    13  and ses_addr    =   saddr;
    UNDO_USED_BLK UNDO_USED_KB LOGICAL_IO CONSISTENT_GETS
               27          216      13893         1042736
    SQL> rollback;
    Rollback complete.
    SQL> insert /*+ append */ into t select * from all_objects;
    56108 rows created.
    SQL> select
      2      used_ublk undo_used_blk,
      3      used_ublk * blk_size_kb undo_used_kb,
      4      log_io logical_io,
      5      cr_get consistent_gets
      6  from
      7      v$transaction, v$session s,
      8      (select distinct sid from v$mystat) m,
      9      (select to_number(value)/1024 blk_size_kb
    10          from v$parameter where name='db_block_size')
    11  where
    12      m.sid       =   s.sid
    13  and ses_addr    =   saddr;
    UNDO_USED_BLK UNDO_USED_KB LOGICAL_IO CONSISTENT_GETS
                2           16       1307         1041151
    SQL> rollback;
    Rollback complete.
    SQL> create unique index t_idx on t (object_id);
    Index created.
    SQL> insert into t select * from all_objects;
    56109 rows created.
    SQL> select
      2      used_ublk undo_used_blk,
      3      used_ublk * blk_size_kb undo_used_kb,
      4      log_io logical_io,
      5      cr_get consistent_gets
      6  from
      7      v$transaction, v$session s,
      8      (select distinct sid from v$mystat) m,
      9      (select to_number(value)/1024 blk_size_kb
    10          from v$parameter where name='db_block_size')
    11  where
    12      m.sid       =   s.sid
    13  and ses_addr    =   saddr;
    UNDO_USED_BLK UNDO_USED_KB LOGICAL_IO CONSISTENT_GETS
               88          704      20908         1043193
    SQL> rollback;
    Rollback complete.
    SQL> insert /*+ append */ into t select * from all_objects;
    56109 rows created.
    SQL> select
      2      used_ublk undo_used_blk,
      3      used_ublk * blk_size_kb undo_used_kb,
      4      log_io logical_io,
      5      cr_get consistent_gets
      6  from
      7      v$transaction, v$session s,
      8      (select distinct sid from v$mystat) m,
      9      (select to_number(value)/1024 blk_size_kb
    10          from v$parameter where name='db_block_size')
    11  where
    12      m.sid       =   s.sid
    13  and ses_addr    =   saddr;
    UNDO_USED_BLK UNDO_USED_KB LOGICAL_IO CONSISTENT_GETS
               57          456       2310         1041047

  • Need help in sql insert

    Hi,
    I have a table with named as cust_pkg_tbl and data contains as below.scrcdall column contain comma separated strings.
    id name memstatus mobileno srccdall
    1001 kaushik 8 9876549032 cde1,cde2,cde3
    1002 ram 4 8845670982 cde1,cde2
    1003 raj 2 8823578432 cde1,cde2,cde3,cde4
    1004 kumar 8 9630987654 cde1,cde2
    Based on the above data client wants to insert as 3/4/2 separate records into the side/lookup table(src_cde_pkg_tbl) as below.
    client wants the data looks like in the below table as src_cde_pkg_tbl.
    id srt_num srccdall
    1001 1 cde1
    1001 2 cde2
    1001 3 cde3
    1002 1 cde1
    1002 2 cde2
    1003 1 cde1
    1003 2 cde2
    1003 3 cde3
    1003 4 cde4
    1004 1 cde1
    1004 2 cde2
    could you please help me to achieve the requirement.
    thx in advance

    You've posted enough times to know you need to provide your 4 digit Oracle version.
    >
    Based on the above data client wants to insert as 3/4/2 separate records into the side/lookup table(src_cde_pkg_tbl) as below.
    >
    That similar question has been answered many times on the forum.
    See the faq about converting rows to columns
    SQL and PL/SQL FAQ
    And search the forum for columns to rows.

  • Need help with Bulk Collect ForAll Update

    Hi - I'm trying to do a Bulk Collect/ForAll Update but am having issues.
    My declarations look like this:
         CURSOR cur_hhlds_for_update is
            SELECT hsh.household_id, hsh.special_handling_type_id
              FROM compas.household_special_handling hsh
                 , scr_id_lookup s
             WHERE hsh.household_id = s.id
               AND s.scr = v_scr
               AND s.run_date = TRUNC (SYSDATE)
               AND effective_date IS NULL
               AND special_handling_type_id = 1
               AND created_by != v_user;
         TYPE rec_hhlds_for_update IS RECORD (
              household_id  HOUSEHOLD_SPECIAL_HANDLING.household_id%type,
              spec_handl_type_id HOUSEHOLD_SPECIAL_HANDLING.SPECIAL_HANDLING_TYPE_ID%type
         TYPE spec_handling_update_array IS TABLE OF rec_hhlds_for_update;
         l_spec_handling_update_array  spec_handling_update_array;And then the Bulk Collect/ForAll looks like this:
           OPEN cur_hhlds_for_update;
           LOOP
            FETCH cur_hhlds_for_update BULK COLLECT INTO l_spec_handling_update_array LIMIT 1000;
            EXIT WHEN l_spec_handling_update_array.count = 0;
            FORALL i IN 1..l_spec_handling_update_array.COUNT
            UPDATE compas.household_special_handling
               SET effective_date =  TRUNC(SYSDATE)
                 , last_modified_by = v_user
                 , last_modified_date = SYSDATE
             WHERE household_id = l_spec_handling_update_array(i).household_id
               AND special_handling_type_id = l_spec_handling_update_array(i).spec_handl_type_id;
              l_special_handling_update_cnt := l_special_handling_update_cnt + SQL%ROWCOUNT;         
          END LOOP;And this is the error I'm receiving:
    ORA-06550: line 262, column 31:
    PLS-00436: implementation restriction: cannot reference fields of BULK In-BIND table of records
    ORA-06550: line 262, column 31:
    PLS-00382: expression is of wrong type
    ORA-06550: line 263, column 43:
    PL/SQL: ORA-22806: not an object or REF
    ORA-06550: line 258, column 9:
    PL/SQL: SQMy problem is that the table being updated has a composite primary key so I have two conditions in my where clause. This the the first time I'm even attempting the Bulk Collect/ForAll Update and it seems like it would be straight forward if I was only dealing with a single-column primary key. Can anyone please help advise me as to what I'm missing here or how I can accomplish this?
    Thanks!
    Christine

    You cannot reference a column inside a record when doin a for all. You need to refer as a whole collection . So you will need two collections.
    Try like this,
    DECLARE
       CURSOR cur_hhlds_for_update
       IS
          SELECT hsh.household_id, hsh.special_handling_type_id
            FROM compas.household_special_handling hsh, scr_id_lookup s
           WHERE hsh.household_id = s.ID
             AND s.scr = v_scr
             AND s.run_date = TRUNC (SYSDATE)
             AND effective_date IS NULL
             AND special_handling_type_id = 1
             AND created_by != v_user;
       TYPE arr_household_id IS TABLE OF HOUSEHOLD_SPECIAL_HANDLING.household_id%TYPE
                                   INDEX BY BINARY_INTEGER;
       TYPE arr_spec_handl_type_id IS TABLE OF HOUSEHOLD_SPECIAL_HANDLING.SPECIAL_HANDLING_TYPE_ID%TYPE
                                         INDEX BY BINARY_INTEGER;
       l_household_id_col         arr_household_id;
       l_spec_handl_type_id_col   arr_spec_handl_type_id;
    BEGIN
       OPEN cur_hhlds_for_update;
       LOOP
          FETCH cur_hhlds_for_update
            BULK COLLECT INTO l_household_id_col, l_spec_handl_type_id_col
          LIMIT 1000;
          EXIT WHEN cur_hhlds_for_update%NOTFOUND;
          FORALL i IN l_household_id_col.FIRST .. l_household_id_col.LAST
             UPDATE compas.household_special_handling
                SET effective_date = TRUNC (SYSDATE),
                    last_modified_by = v_user,
                    last_modified_date = SYSDATE
              WHERE household_id = l_household_id_col(i)
                AND special_handling_type_id = l_spec_handl_type_id_col(i);
       --l_special_handling_update_cnt := l_special_handling_update_cnt + SQL%ROWCOUNT; -- Not sure what this does.
       END LOOP;
    END;G.

  • Needed help in bulk collect using collections

    Hi,
    I have created a schema level collection like "CREATE OR REPLACE TYPE T_EMP_NO IS TABLE OF NUMBER ;
    will i able to use this in a where clause which involves bulk collect?
    Please share ur thoughts.
    My oracle version is 10g

    user13710379 wrote:
    Will i be able to do a bulk collect into a table using this collection of my sql type?Bulk fetches collects into an array like structure - not into a SQL table like structure. So calling a collection variable in PL/SQL a "+PL/SQL table+" does not make much sense as this array structure is nothing like a table. For the same reason, one needs to question running SQL select statements against PL/SQL arrays.
    As for your SQL type defined - it is a collection (array) of numbers. Thus it can be used to bulk fetch a numeric column.

  • Need help creating an "insert file" to add an attachment to a form?  Is this possible?

    I am trying to add an "insert file/attachment" field to a form that I'm creating but am having trouble finding information.   Is this possible?   Please advise.
    Thank you!

    Hi,
    The form with add attachment feature on link http://eslifeline.files.wordpress.com/2009/04/addattachments.pdf
    works fine but when I copy paste objects to use 2-3 times on page 2 and 3 then after attaching different files at all 3 sections, I see only same type of files when using view attachments. I understand it is same like when making 2 fields name same act same together.
    Please help me make the javascript run differently (as new) for each add attachment function.
    Thanks

  • I need help in sql insert statement

    sorry i cant speak English very well
    ======================
    i have a table contains two columns date_2011 and salary
    date_2011 || salary
    ====================
    1-1-2011 || 1000$
    2-1-2011 || 2000$
    7-1-2011 || 500$
    11-1-2011 || 200$
    my question is
    i need a sql statement to view Table as this table
    FROM || TO || Total Salary
    ==================================
    1-1-2011 || 2-1-2011 || 3000$
    7-1-2011 || 11-1-2011 || 700$

    try this
    SQL> with t as
      2  (
      3  select to_date('1-1-2011','dd-mm-yyyy') date_2011, 1000 salary from dual union all
      4  select to_date('2-1-2011','dd-mm-yyyy'), 2000 from dual union all
      5  select to_date('7-1-2011','dd-mm-yyyy'), 500 from dual union all
      6  select to_date('11-1-2011','dd-mm-yyyy'),  200 from dual
      7  ), t2 as(
      8  select
      9  date_2011 as date_from ,
    10  lead(date_2011, 1, null) over(order by date_2011) date_to,
    11  salary + lead(salary, 1, null) over(order by date_2011) sal
    12  , rownum rn
    13  from t order by date_2011)
    14  --
    15  select date_from as" from", date_to as "to", sal as "Total Salary"  from t2 where mod(rn,2) != 0;
    from    to       Total Salary
    01.01.11 02.01.11         3000
    07.01.11 11.01.11          700
    SQL>

  • Really need help with an insert form

    I attempted to implement a cascading select list (via sergios blog); which was helpful. I created an office_id field as a select list with submit in order to populate another select list with the appropriate list of salespeople. But now the rest of my fields on the page are reset and I can't successfully add a record. I am wondering if I should be using a select list with submit or redirect or perhaps a computation for the page to achieve the same behavior but that doesn't submit the page until all fields are completed. Even if I fill out the office_id (the submit occurs)> I pick my salesperson then proceed to fill out the rest of the fields the row will not save when clicking the create button.

    select
    from table(cast(V_UserInfoin as T_UserInfo));

  • Need help deleting bulk e-mail

    How do I delete 21,000 messages easily and quickly. Only options seems to be 30 at a time......

    I point to
    http://forums.verizon.com/t5/Verizon-net-Email/How​-to-delete-thousands-of-emails/m-p/475355#M9196
    and I quote from it.
    1. Click on Settings
    2. Change Number of messages per page  to "no limit"
    3. Click on "save" below display tab and Click on "OK" on the pop up
    That is the secret my friends
    The next time you are in your inbox and Click on the select all rows button (below delete button) and it will select all of the inbox
    Click on "delete" button and it is DONE!
    If you are the original poster (OP) and your issue is solved, please remember to click the "Solution?" button so that others can more easily find it. If anyone has been helpful to you, please show your appreciation by clicking the "Kudos" button.

  • Need Help with Inserting Timeline Markers

    Friends,
    I have not use my premiere element 3.2 since 2008 and forgot some of the procedures. now, I need help with the insertion of Timeline Markers. I did what the Help Page showed me. But the markers were not effective in the resulting DVD, or, even when viewing the video in the editing page as if thye were not there! Here is what I did:.
    1)  Click the Timeline button.
    2)  Click in an empty space in a video or audio track in the Timeline to make the Timeline active and deselect any clips.
    3)  Move the current-time indicator in the Timeline to the frame where I need the marker.
    4)  Click the Add Marker icon in the Timeline to place the Marker 5 times where I want them.
    5)  Verified that each Timeline Marker is present at the intended place.
    6)  Burned DVD
    7)  Can NOT jump to any of the intended Marker in the Resulting DVD during playback.
    The question is "What did I do wrong or didn't do?" It seems that I did the same before and worked! Please advise!
    Also, what are the significance of the Red line just below the Timeline and the yellow bars inside the video and audio frames. But after preforming Timeline/Render Work Area, they were all gone? What purposes do they serve and what is the significance of Rendering? Thank you for your help!
    I repeat the process and did a Rendering before making the DVD also. It did not help!
    Andy Lim

    Steve,
    Long time no talk! You used to help me out many times when the PE-1 through PE-3 came out. I was HOPING you would still be around and you are! You came through again this time! Many thanks to you.
    I use the Add DVD Scene button to insert the Markers. They are Green. Made a DVD and the markers work OK although ythey are "effective" during play back using the editing window.
    While that problem was solved, will you come back and answer the other two questions concerning Rendering and the Red/Yellow lines? I would appreciate it very much!
    Andy Lim
    ~~~~~~~~~~~~~~~~

  • HOW to USE 'LONG RAW' in Bulk Insertion using OCI

    Hi,
    I need to do bulk insertion of LONG RAW data into a table using the OCI.
    To the OCIBindByPos API what should I specify in the field size(value_sz). As different records can have different lenght for this LONG RAW data what value should I provide.
    Thanks,
    Tuhin
    sword OCIBindByPos ( OCIStmt *stmtp,
    OCIBind **bindpp,
    OCIError *errhp,
    ub4 position,
    dvoid *valuep,
    sb4 value_sz,
    ub2 dty,
    dvoid *indp,
    ub2 *alenp,
    ub2 *rcodep,
    ub4 maxarr_len,
    ub4 *curelep,
    ub4 mode );

    ORA-00997: illegal use of LONG datatype
    Cause: A value of datatype LONG was used in a function or in a DISTINCT, WHERE, CONNECT BY, GROUP BY, or ORDER BY clause. A LONG value can only be used in a SELECT clause.
    Action: Remove the LONG value from the function or clause
    Are you using the column anywhere else but in the SELECT?

  • SQL2K, XML Bulk Insert woes. Please Help

    I have Win2k3 server with latest sp's. I have mssql 2k
    enterprise with SP4. I have installed sqlxml3.0 sp 3. I've tried
    the examples in the documentation but cannot get this to work. I
    really need to be able to do a bulk insert using the xml file below
    through a coldfusion query. I saw an example online how to do it
    with CF and followed the example to the letter and get this error:
    Could not bulk insert. Unknown version of format file
    'D:\Websites\globalFunctions]getEventPerformersMapping.xml'.
    My XML file ("getEventPerformers.txt") looks like this:
    <ROOT>
    <EventPerformer>
    <EventID>448410</EventID>
    <PerformerID>3160</PerformerID>
    <PerformerName>Lion King</PerformerName>
    </EventPerformer>
    <EventPerformer>
    <EventID>448412</EventID>
    <PerformerID>3160</PerformerID>
    <PerformerName>Lion King</PerformerName>
    </EventPerformer>
    </ROOT>
    The format file I'm using (that I got from the online
    example) is:
    <?xml version="1.0" ?>
    <Schema xmlns="urn:schemas-microsoft-com:xml-data"
    xmlns:dt="urn:schemas-microsoft-com:xml:datatypes"
    xmlns:sql="urn:schemas-microsoft-com:xml-sql" >
    <ElementType name="EventID" dt:type="i8" />
    <ElementType name="PerformerID" dt:type="int" />
    <ElementType name="PerformerName" dt:type="string" />
    <ElementType name="ROOT" sql:is-constant="1">
    <element type="EventPerformer" />
    </ElementType>
    <ElementType name="EventPerformer"
    sql:relation="tbl_EventPerformers">
    <element type="EventID" sql:field="EventID" />
    <element type="PerformerID" sql:field="PerformerID" />
    <element type="PerformerName" sql:field="PerformerName"
    />
    </ElementType>
    </Schema>
    My db table structure is this:
    EventID - bigint - Primary Key
    PerformerID - int
    PerformerName varchar(100)
    In the msdn docs there is an example that uses VB script
    create a SQLXMLBulkLoad.SQLXMLBulkload.3.0 object, but I couldn't
    get that to work either.
    Someone please help!

    I've got the same problem:
    We're porting from Orion to Tomcat and the following erro occurs at the following line:
         response.sendRedirect("asistente/frmresultat.jsp?ant=false");

  • Need help with INSERT and WITH clause

    I wrote sql statement which correctly work, but how i use this statment with INSERT query? NEED HELP. when i wrote insert i see error "ORA 32034: unsupported use of with clause"
    with t1 as(
    select a.budat,a.monat as period,b.vtweg,
    c.gjahr,c.buzei,c.shkzg,c.hkont, c.prctr,
    c.wrbtr,
    c.matnr,
    c.menge,
    a.monat,
    c.zuonr
    from ldw_v1.BKPF a,ldw_v1.vbrk b, ldw_v1.bseg c
    where a.AWTYP='VBRK' and a.BLART='RV' and a.BUKRS='8431' and a.awkey=b.vbeln
    and a.bukrs=c.bukrs and a.belnr=c.belnr and a.gjahr=c.gjahr and c.koart='D'
    and c.ktosl is null and c.gsber='4466' and a.gjahr>='2011' and b.vtweg='01'
    ,t2 as(
    select a.BUKRS,a.BELNR, a.GJAHR,t1.vtweg,t1.budat,t1.monat from t1, ldw_v1.bkpf a
    where t1.zuonr=a.xblnr and a.blart='WL' and bukrs='8431'
    ,tcogs as (
    select t2.budat,t2.monat,t2.vtweg, bseg.gjahr,bseg.hkont,bseg.prctr,
    sum(bseg.wrbtr) as COGS,bseg.matnr,bseg.kunnr,sum(bseg.menge) as QUANTITY
    from t2, ldw_v1.bseg
    where t2.bukrs=bseg.bukrs and t2.belnr=bseg.BELNR and t2.gjahr=bseg.gjahr and BSEG.KOART='S'
    group by t2.budat,t2.monat,t2.vtweg, bseg.gjahr,bseg.hkont,bseg.prctr,
    bseg.matnr,bseg.kunnr
    ,t3 as
    select a.budat,a.monat,b.vtweg,
    c.gjahr,c.buzei,c.shkzg,c.hkont, c.prctr,
    case when c.shkzg='S' then c.wrbtr*(-1)
    else c.wrbtr end as NTS,
    c.matnr,c.kunnr,
    c.menge*(-1) as Quantity
    from ldw_v1.BKPF a,ldw_v1.vbrk b, ldw_v1.bseg c
    where a.AWTYP='VBRK' and a.BLART='RV' and a.BUKRS='8431' and a.awkey=b.vbeln
    and a.bukrs=c.bukrs and a.belnr=c.belnr and a.gjahr=c.gjahr and c.koart='S'
    and c.ktosl is null and c.gsber='4466' and a.gjahr>='2011' and b.vtweg='01'
    ,trevenue as (
    select t3.budat,t3.monat,t3.vtweg, t3.gjahr,t3.hkont,t3.prctr,
    sum(t3.NTS) as NTS,t3.matnr,t3.kunnr,sum(t3.QUANTITY) as QUANTITY
    from t3
    group by t3.budat,t3.monat,t3.vtweg, t3.gjahr,t3.hkont,t3.prctr,t3.matnr,t3.kunnr
    select NVL(tr.budat,tc.budat) as budat,
    NVL(tr.monat,tc.monat) as monat,
    NVL(tr.vtweg,tc.vtweg) as vtweg,
    NVL(tr.gjahr, tc.gjahr) as gjahr,
    tr.hkont as NTS_hkont,
    tc.hkont as COGS_hkont,
    NVL(tr.prctr,tc.prctr) as prctr,
    NVL(tr.MATNR, tc.MATNR) as matnr,
    NVL(tr.kunnr, tc.kunnr) as kunnr,
    NVL(tr.Quantity, tc.Quantity) as Quantity,
    tr.NTS as NTS,
    tc.COGS as COGS
    from trevenue TR full outer join tcogs TC
    on TR.BUDAT=TC.BUDAT and TR.MONAT=TC.MONAT and TR.GJAHR=TC.GJAHR
    and TR.MATNR=TC.MATNR and TR.KUNNR=TC.KUNNR and TR.QUANTITY=TC.QUANTITY
    and TR.VTWEG=TC.VTWEG and TR.PRCTR=TC.PRCTR
    Edited by: user13566113 on 25.03.2011 5:26

    Without seeing what you tried it is hard to say what you did wrong, but this is how it would work
    SQL> create table t ( n number );
    Table created.
    SQL> insert into t
      2  with test_data as
      3    (select 1 x from dual union all
      4     select 2 x from dual union all
      5     select 3 x from dual union all
      6     select 4 x from dual)
      7  select x from test_data;
    4 rows created.
    SQL>

Maybe you are looking for

  • RPC through DB Link from 11g to 10g doesn't work

    Guys, I am unable to make simple RPC to an Oracle 10g database (Running on Unix Server) from Oracle 11g database (Running on XP Professional). But RPC Call from 10g to 11g works fine. Any idea? C:\temp>sqlplus /nolog SQL*Plus: Release 11.1.0.6.0 - Pr

  • How to see JSP compilation errors - Tomcat 4.1.18- JDK 1.4

    Hi There, I'm kind of new to JSP world, so once in while I forget to put a ; or I put a variable name wrong (I usualy use Eclipse to do my coding in JAVA, but the existing plugins for JSP development are still in their early stages, so there's isn't

  • Cube takes a lot of time to maintain

    Hi I am trying to compile a cube that has the following details 1. Fact Table, no of rows: 670000 2. Dim table 1, no of rows: 496039. Sort option while maintaining is set to yes 3. Dim table 2, no of rows: 1822 Sort option while maintaining is set to

  • Taskflow train with child taskflow step problem

    Hi, If I use a child train taskflow (step 2 ) in a train then I can't get back to main train. and the train jsf components are disabeld in this page. If I try to return manually then I get a error. pic1 train overview , step 2 is the child taskflow h

  • INTERNAL TABLE UNIQUE CONTENTS

    Hi to all Plz tell me I want to select unique enteries from an internal table then then counting of that unique entrie. For example    ITAB EBELN               0026000060 0026000060 0026000060 0026000060 0026000061 0026000061 0026000061 0026000062 00