How to insert 10 rows at a time in the oracle

how ti insert r update 10 query at a time in the oracle

You can do a small test to find it out.
SQL> set serveroutput on
SQL> drop table t
  2  /
Table dropped.
SQL> drop table s
  2  /
Table dropped.
SQL> create table s(no integer, name varchar2(4000))
  2  /
Table created.
SQL> create table t(no integer, name varchar2(4000))
  2  /
Table created.
SQL> insert into s
  2  select level, rpad('*',4000,'*')
  3    from dual
  4  connect by level <= 10000
  5  /
10000 rows created.
SQL> commit
  2  /
Commit complete.
SQL> declare
  2     ltime integer;
  3  begin
  4     ltime := dbms_utility.get_time;
  5
  6     for i in (select * from s)
  7     loop
  8             insert into t(no, name) values(i.no,i.name);
  9     end loop;
10
11     ltime := dbms_utility.get_time - ltime;
12
13     dbms_output.put_line('Exec Time:'||ltime/100||' Seconds...');
14     commit;
15  end;
16  /
Exec Time:17.22 Seconds...
PL/SQL procedure successfully completed.
SQL> truncate table t
  2  /
Table truncated.
SQL> declare
  2     type my_type is table of s%rowtype;
  3     lType my_type;
  4     ltime integer;
  5  begin
  6     ltime := dbms_utility.get_time;
  7
  8     select * bulk collect into lType from s;
  9
10     forall i in 1..lType.count
11             insert into t values lType(i);
12
13     ltime := dbms_utility.get_time - ltime;
14
15     dbms_output.put_line('Exec Time:'||ltime/100||' Seconds...');
16
17     commit;
18  end;
19  /
Exec Time:6.27 Seconds...
PL/SQL procedure successfully completed.
SQL> truncate table t
  2  /
Table truncated.
SQL> declare
  2     ltime integer;
  3  begin
  4     ltime := dbms_utility.get_time;
  5
  6     insert into t select * from s;
  7
  8     ltime := dbms_utility.get_time - ltime;
  9
10     dbms_output.put_line('Exec Time:'||ltime/100||' Seconds...');
11
12     commit;
13  end;
14  /
Exec Time:3.26 Seconds...
PL/SQL procedure successfully completed.Thanks,
Karthick.

Similar Messages

  • How to add new row and update existing rows at a time form the upload file

    hi
    How to add new row and update existing rows at a time form the upload file
    example:ztable(existing table)
    bcent                      smh            nsmh         valid date
    0001112465      7.4                       26.06.2007
    0001112466      7.5                       26.06.2007
    000111801                      7.6                       26.06.2007
    1982                      7.8                       26.06.2007
    Flat file structure
    bcent                       nsmh         valid date
    0001112465     7.8     26.06.2007  ( update into above table in nsmh)
    0001112466     7.9     26.06.2007  ( update into above table in nsmh) 
    000111801                     7.6      26.06.2007 ( update into above table in nsmh
    1985                      11              26.06.2007   new row it should insert in table
    thanks,
    Sivagopal R

    Hi,
    First upload the file into an internal table. If you are using a file that is on application server. Use open dataset and close dataset.
    Then :
    Loop at it.
    *insert or modify as per your requirement.
    Endloop.
    Regards,
    Srilatha.

  • JTable: HOW TO INSERT ROWS AND DATA?

    I have one JFrame on screen and inside of this i have a JTable, the question is how to insert rows and data into the JTable?

    [http://java.sun.com/docs/books/tutorial/uiswing/components/table.html]
    In future, please post Swing questions to the [Swing Forum.|http://forums.sun.com/forum.jspa?forumID=57]
    In short, your TableModel is probably a DefaultTableModel . Study its API.

  • How to insert rows & columns into a jTable???

    helloo there...
    How to insert rows & columns into a jtable???
    your reply is greatly appreciated....
    -=samer=-

    Yes!thanks...
    But what i want is how to set the number of rows and the number of columns...and i don't know how to setColumns and rows....any idea?
    the user will input number of rows and columns in a jtextfield....
    Please rply...

  • How to insert more than 32k xml data into oracle clob column

    how to insert more than 32k xml data into oracle clob column.
    xml data is coming from java front end
    if we cannot use clob than what are the different options available

    Are you facing any issue with my code?
    String lateral size error will come when you try to insert the full xml in string format.
    public static boolean writeCLOBData(String tableName, String id, String columnName, String strContents) throws DataAccessException{
      boolean isUpdated = true;
      Connection connection = null;
      try {
      connection = ConnectionManager.getConnection ();
      //connection.setAutoCommit ( false );
      PreparedStatement PREPARE_STATEMENT = null;
      String sqlQuery = "UPDATE " + tableName + " SET " + columnName + "  = ?  WHERE ID =" + id;
      PREPARE_STATEMENT = connection.prepareStatement ( sqlQuery );
      // converting string to reader stream
      Reader reader = new StringReader ( strContents );
      PREPARE_STATEMENT.setClob ( 1, reader );
      // return false after updating the clob data to DB
      isUpdated = PREPARE_STATEMENT.execute ();
      PREPARE_STATEMENT.close ();
      } catch ( SQLException e ) {
      e.printStackTrace ();
      finally{
      return isUpdated;
    Try this JAVA code.

  • *Urgent*How to insert data from MS SQL to the table that create at the adobe form?

    Hi,
    I'm using Adobe life cycle designer 8 to do my interactive form. I would like to ask how to insert data from MS SQL to the table that i have created in my adobe interactive form?
    I really need the information ASAP as i need to hand in my project by next week... i really appreciate any one who reply this post.
    Thanks

    Tou need to do a couple of things
    1. On the Essbase server, set up an odbc system connection to your MySQL database
    2. In the load rule , go to the file menu and select open SQL data source and in the data source put in your SQL statement . A couple of hints. Where it says Select, don't put in the word select and where it say from don't put in from. The system adds them for you. The easiest way ti enter a SQL statement is to do it all in the select area So if your SQL would normanlly say select * from mytable just enter the code as * from mytable in the select area
    The click ol/retrieve and enter in your connection info. Itshould bring data back into the load rule. Save the load rule and use it

  • How i can change my face time for the green one??

    how i can change my face time to the green one??

    No way that I know of.  It appears that Apple change the color with the last update.  I tried resetting the iPod and it did not change to the old green.

  • How to insert same record multiple times in a loop..

    Dear All,
    I need to insert a record multiple time how it can be accomplish...
    eg:
    ref no name dept
    123     abc 1     
    122 def 2
    121 feg 1
    120 hhh 2
    while inserting into another table:
    all dept no 1 with should inserted 3 times for each record above
    final out put should be :
    table abc
    ref no name dept
    123     abc 1
    123     abc 1
    123     abc 1     
    122 def 2
    121 feg 1
    121 feg 1
    121 feg 1
    120 hhh 2
    Thank You

    user3029023 wrote:
    Dear All,
    I need to insert a record multiple time how it can be accomplish...
    eg:
    ref no name dept
    123     abc 1     
    122 def 2
    121 feg 1
    120 hhh 2
    while inserting into another table:
    all dept no 1 with should inserted 3 times for each record above
    final out put should be :
    table abc
    ref no name dept
    123     abc 1
    123     abc 1
    123     abc 1     
    122 def 2
    121 feg 1
    121 feg 1
    121 feg 1
    120 hhh 2
    Thank YouTry this .
    SQL> ed
    Wrote file afiedt.buf
      1  with t as
      2  (select '123' AS ref_no,'abc' AS name,'1' as Dept
      3  from dual
      4  union all
      5  select '122','def','2' from dual
      6  union all
      7  select '333','feg','1' from dual
      8  union all
      9  select '120','hhh','2' from dual
    10  )
    11  select ref_no,name,Dept from t,(select level x from dual connect by  level <4)
    12* order by 1
    SQL> /
    REF NAM D
    120 hhh 2
    120 hhh 2
    120 hhh 2
    122 def 2
    122 def 2
    122 def 2
    123 abc 1
    123 abc 1
    123 abc 1
    333 feg 1
    333 feg 1
    333 feg 1
    12 rows selected.And insert the same onto your desired table.
    Hope this Helps..
    Regards,
    Achyut

  • How to insert into two differents tables at the same time

    Hi
    I'm newer using JDev, (version 3.1.1.2 cause the OAS seems to support just the JSP 1.0)
    and I want to insert into two differents tables at the same time using one view.
    How can I do that ?
    TIA
    Edgar

    Oracle 8i supports 'INSTEAD OF' triggers on object views so you could use a process similar to the following:
    1. Create an object view that joins your two tables. 'CREATE OR REPLACE VIEW test AS SELECT d.deptno, d.deptname, e.empname FROM DEPT d, EMP E'.
    2. Create an INSTEAD OF trigger on the view.
    3. Put code in the trigger that looks at the :NEW values being processed and determines which columns should be used to INSERT or UPDATE for each table. Crude pseudo-code might be:
    IF :NEW.deptno NOT IN (SELECT deptno FROM DEPT) THEN
    INSERT INTO dept VALUES(:NEW.deptno, :NEW.deptname);
    INSERT INTO emp VALUES (:NEW.deptno, :NEW.empname);
    ELSE
    IF :NEW.deptname IS NOT NULL THEN
    UPDATE dept SET deptname = :NEW.deptname
    WHERE deptno = :NEW.deptno;
    END IF;
    IF :NEW.empname IS NOT NULL THEN
    UPDATE emp SET empname = :NEW.empname
    WHERE deptno = :NEW.deptno;
    Try something along those lines.
    null

  • How to insert row where DB date field has default value.

    APEX 4.1, Oracle 11.2
    I'm trying to insert a row using "javascript:addRow();" where the report query is an SQL Query (Updateable Report).
    1)  Several of the fields are display-only with defaulted values.
    2)  No problem with the VARCHAR2 fields.
    3)  And if RUN_DT is a text field, the insert works.
    4)  But I get errors when trying to make RUN_DT (DD-MON-YYYY) display-only and default it to P63_RUN_DT.  I display P63_RUN_DT so I see it is correct.
    Now, this is not a new question.  See:
    Error inserting sysdate with time in tabular form region  https://forums.oracle.com/thread/2551916  (Not answered)
    Date value in tabular form  https://forums.oracle.com/thread/2478358 (Not answered)
    Help! Unable to set default date value for Tabular form DB date field! https://forums.oracle.com/thread/2473208  (Not answered)
    Default Value Date Picker Field https://forums.oracle.com/thread/2468973  (Not answered)
    Tabular Form Default Value PL/SQL https://forums.oracle.com/thread/2464192  (Not answered)
    Display 1st region invoice date into tabular form invoice date column. https://forums.oracle.com/thread/2458561  (Not answered)
    Default System date and time in Tabular form https://forums.oracle.com/thread/2449615 (Not answered)
    Setting default value of Tabular form item is not working https://forums.oracle.com/thread/2396024 (Not answer)
    apex tabular form https://forums.oracle.com/thread/2337098 (Not answered)
    Various folks recommended using Default PL/SQL and SYSDATE when SYSDATE was the desired default value.  That worked for some and not for others.  I could not get it to work for me.  The errors I receive are "•Column must have a value. (Row 1) " and "ORA-01410: invalid ROWID".   I believe the ROWID error is an example of spurious error cascade caused by the RUN_DT problem.   I believe it will disappear once the RUN_DT problem is solved.
    I will try to replicate on apex.oracle.com
    Thoughts?
    Howard

    Update: At least in my case, it seems the RUN_DT date column cannot be Standard Report Column.  I made it "Display as Text (saves state)".  Standard Report Column works for the defaulted VARCHAR2 columns.  Go figure! 
    (more)  And I could not get it to work with "Item" (P63_RUN_DT) as the Default.   However, it seems to work -- so far -- using Default PL/SQL of TO_DATE(:P63_RUN_DT,'DD-MON-YYYY').

  • How to insert single colon xml text in the xml table

    Dear Sir,
    how to insert special characters like single colon text example (don't) xml text in to the xml table
    please see the following example its giving me error quoted string is not ended properly
    SQL> insert into ftr_ctl values (1,
    2 xmltype('<po:root xmlns:po="http://www.oracle.com/FC.xsd"
    3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    4 xsi:schemaLocation="http://www.oracle.com/FC.xsd
    5 http://www.oracle.com/FC.xsd">
    6 <row>
    7 <UniqueIdentifier>urn:x-gcs:def:featureType:GFDD::FT_DFDD_100565</UniqueIdentifier>
    8 <AlphaCode>ZB032</AlphaCode>
    9 <Name>Baseline Point</Name>
    10 <Status>Submitted</Status>
    11 <Definition>A location that serves as a point on, and which partially defines a segment
    of, a national boundary baseline.</Definition>
    12 <Description>May be monumented or unmonumented. A national boundary baseline is used fo
    r defining the landward edge or margin of a nation's various contiguous zones such as the 3 and 12 n
    autical mile limits and the Exclusive Economic Zone (EEZ).</Description>
    13 </row>
    14 </po:root>'));
    ERROR:
    ORA-01756: quoted string not properly terminated
    how to solve single quotation like (nation's) in xml data insertion
    please give me reply as soon as possible
    Thanks
    Kabeer

    Hi,
    Use &#x7B;code} tags to post formatted code on the forum.
    That way, your code will be more readable for everyone, and more importantly here, everyone will be able to clearly see what's bothering you :
    &apos;sThe single quote was encoded with the character entity reference "&amp;apos;".
    The conversion is not mandatory but it happens Oracle is doing it in this case.
    It shouldn't be a problem though.
    If you want to extract the value afterwards, it'll come as expected :
    SQL> create table ftr_ctl (id number, doc xmltype);
    Table created
    SQL> insert into ftr_ctl values (1,
      2  xmltype('<po:root xmlns:po="http://www.oracle.com/FC.xsd"
      3  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      4  xsi:schemaLocation="http://www.oracle.com/FC.xsd
      5  http://www.oracle.com/FC.xsd">
      6  <row>
      7  <UniqueIdentifier>urn:x-gcs:def:featureType:GFDD::FT_DFDD_100565</UniqueIdentifier>
      8  <AlphaCode>ZB032</AlphaCode>
      9  <Name>Baseline Point</Name>
    10  <Status>Submitted</Status>
    11  <Definition>A location that serves as a point on, and which partially defines a segment of, a national boundary baseline.</Definition>
    12  <Description>May be monumented or unmonumented. A national boundary baseline is used for defining the landward edge or margin of a nation''s various contiguous zones such as the 3 and 12 nautical mile limits and the Exclusive Economic Zone (EEZ).</Description>
    13  <Alias xsi:nil="true"></Alias>
    14  <SourceItemIdentifier>100565</SourceItemIdentifier>
    15  <SourceReference>DGIWG DFDD BL 2011-1.00</SourceReference>
    16  <SourceURL>https://www.dgiwg.org/FAD/fdd/view?i=100565</SourceURL>
    17  </row>
    18  </po:root>'));
    1 row inserted
    SQL> select extractvalue(doc, '/po:root/row/Description','xmlns:po="http://www.oracle.com/FC.xsd"')
      2  from ftr_ctl
      3  where id = 1
      4  ;
    EXTRACTVALUE(DOC,'/PO:ROOT/ROW/DESCRIPTION','XMLNS:PO="HTTP://WWW.ORACLE.COM/FC.
    May be monumented or unmonumented. A national boundary baseline is used for defi
    ning the landward edge or margin of a nation's various contiguous zones such as
    the 3 and 12 nautical mile limits and the Exclusive Economic Zone (EEZ).
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to play one clip multiple times at the same time?

    I am writing a little game where a certain sound has to be played quite frequently. I load it as a Clip and play it with
    myClip.setFramePosition(0);
    myClip.loop(0);If the sound has to be played again but is still being played by another event, the setFramePosition() method resets the sound and the first playing instance is cut off.
    A workaround would be that each object that needs to play this sound would get its own copy, but that is not feasible due to heavy memory consumption.
    So here it goes: How can I play a single sound multiple times at the same time? Is that possible?
    Edited by: andrasz on Feb 27, 2009 12:37 AM

    If the sound has to be played again but is still being played by another event, the setFramePosition() method resets the sound and the first playing instance is cut off.
    A workaround would be that each object that needs to play this sound would get its own copy, but that is not feasible due to heavy memory consumption.
    So here it goes: How can I play a single sound multiple times at the same time? Is that possible?Ummmm, if you're using a clip, you'll have to maintain one copy per object that needs to play the sound concurrently. You could keep one master copy, and then create copies of the clip as necessary to play them, and then just dump the copies to decrease memory consumption.
    A second idea would be to write your own Clip class. Esentially, all you would need to do is dump some sound data onto a TargetDataline to play it. It'll handle the buffering and playing at the correct speed itself. If that's all you did, you should be able to dump multiple times from the same instance and play it multiple times.
    Obviously, that's just a theory. In practice, it may not work that way...

  • How to insert system date in Session of the page

    Greetings,
    I am stuck at one thing and need guidline.
    I created date parameter "From Date" - "to Date" . Item Type Date Picker.
    - Set Default Value : Sysdate;
    - Default Value Type : PL/SQL Expression.
    When i run the page it shows current date , but when i see session state report of that page there Item Value is Empty and Status is also Empty.
    The result in impact is that i created linked on data that displays, That link doesnt Work because of Item Value is Empty and Status is also Empty.
    Kindly guide how i inserted value in Item Value and in status.
    Pls

    Hi,
    >
    I am stuck at one thing and need guidline.
    I created date parameter "From Date" - "to Date" . Item Type Date Picker.
    - Set Default Value : Sysdate;
    - Default Value Type : PL/SQL Expression.
    When i run the page it shows current date , but when i see session state report of that page there Item Value is Empty and Status is also Empty.
    The result in impact is that i created linked on data that displays, That link doesnt Work because of Item Value is Empty and Status is also Empty.
    Kindly guide how i inserted value in Item Value and in status.
    >
    When you set the value of an item in the source, the value is set in the HTML DOM not the session state.
    To set value in session state use Computation or Process.
    Cheers,

  • Inserting Current Date with time stamp in oracle database

    Hi Experts,
                     I want to insert the current Date and time stamp in a field in the Oracle Database Table.
    I am able to insert date but i am not able to insert the date with time stamp. Any Suggestions??
    Thanks
    Naveen

    Naveen,
    Do you want to get current date (from sysdate) with a specific format or transform a value containing a date/time value to insert it in ORACLE ?
    Usually, you insert current datetimestamp in a date field using this :
    TO_DATE(sysdate,'dd/mm/yyyy hh:mi:ss')
    you may have to tweak the format pattern ('dd/mm....') according to your needs
    if you want to transform a date, use something like this:
    TO_DATE(your_date,your_format)
    but make sure your format is compliant with your date, ie
    TO_DATE('31/12/2008','MM/DD/YYYY') could raise error (litteral does not match) cuz ORACLE can't recognize 31 as a month pattern
    Chris

  • How to insert a dialog box which prompt the user enter the general information in the SDI application?

    Im using the SDI application to build a system and now i would like to insert a dialog box which allow the user to enter the general information about themselves and then it will be saved into a text file. How to insert the dialog box and show the dialog box at the beginning of the program.

    Hi Lee,
    The easyest way to achieve this is to declare an object of your dialog box derived class (e.g. CUserInfo, public CDialog) into the InitInstance method of the main application class.
    Depending on the behavior you want you can place the code before dispatching the commands from command line (in which case the main frame of the SDI application will not be shown), or after, in which case the UserInfo dialog box will be shown over the main application window as modal.
    The code snipped bellow can be more helpfull:
    BOOL CSDIApp::InitInstance()
    AfxEnableControlContainer();
    // Parse command line for standard shell commands, DDE, file open
    CCommandLineInfo cmdInfo;
    ParseCommandLine(cmdInfo);
    //prompt user for data
    CUserInfo dlg;
    if (dlg.DoModal() == IDOK)
    //do something here with the data
    else
    return FALSE;//i.e. quit the application if the user presses the 'Cancel' button
    // Dispatch commands specified on the command line
    if (!ProcessShellCommand(cmdInfo))
    return FALSE;
    // The one and only window has been initialized, so show and update it.
    m_pMainWnd->ShowWindow(SW_SHOW);
    m_pMainWnd->UpdateWindow();
    return TRUE;
    Hope this helps,
    Silvius
    Silvius Iancu

Maybe you are looking for

  • IPod cannot be updated because the file cannot be found

    Just purchased a new 5th gen. 30gb iPod, and when plugged into my laptop & iTunes, I get the error message that "so and so's iPod cannot be updated - the file cannot be found." Then the iPod drops out of itunes, but stays in My Computer. Any way to f

  • Changing themes of application in Flex 3

    Hi All ,below is my  mxml file , in which i am trying to change theme of my flex application by selecting the themes in combo box, but it is not working fine.Is there any bug in code ??? How to change the theme of flex application in Flex 3.. Plzz he

  • IPod pauses abitrarily

    When connected to iPod HiFi or other accessories which combine dock connection with playing music, my iPod abitrarily pauses as if it was disconnected from power supply.

  • Need field names

    hi, In sales order create screen, i need the table/structure name and field names for shipping point, and ship to. for shipping point it think it is vbap-vstel ?? thks

  • Saving Option in Change layout TAB

    Hi , I am taking Sales order list in VA05 I clicked on change layout tab n Selct field as per my requirements but Now I want to save that layout but I am not getting any saving option in menu bar Settings - layout - saving this option is in grey How