Procedure to insert same record for 30 times in a table using for loop

Hi,
I need to insert a record in a table which has to be iterated using for loop

I think you are in the wrong forum. You can do that like this:
CREATE TABLE my_table (my_column NUMBER);
BEGIN
   FOR i IN 1 .. 30
   LOOP
      INSERT INTO my_table
                  (my_column
           VALUES (i
   END LOOP;
END;
/Denes Kubicek
http://deneskubicek.blogspot.com/
http://www.apress.com/9781430235125
http://apex.oracle.com/pls/apex/f?p=31517:1
http://www.amazon.de/Oracle-APEX-XE-Praxis/dp/3826655494
-------------------------------------------------------------------

Similar Messages

  • 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

  • Apply the same LCR two times on different tables

    Hi all
    Just one question:
    Can I apply the same LCR two times on different tables using only one apply queue?
    For example executing two times LCR.EXECUTE(TRUE) in a procedure handler:
    LCR.EXECUTE(TRUE);
    LCR.EXECUTE(TRUE);
    ....

    Topas,
    You need to create new LCR and execute both LCRs.
    Regards,
    Serge

  • Insert same row multiple times

    Hi,
    I've this table TAB1:
    COD.........TYPE........DESCRIP
    1..............RED..............MY COLOR
    I'd like to insert into table TAB2 this record 10000 times
    How can I write my insert or procedure to insert this row multiple times?
    Thanks in advance!

    Hi,
    Assuming tab1.col is unique:
    INSERT INTO tab2 (col_a, col_b, col_c)
    SELECT            cod,   type,  descrip
    FROM    tab1
    START WITH  cod = 1
    CONNECT BY  cod = 1
           AND  LEVEL <= 10000;If tab1.cod is not unique, use whatever is unique in the START WITH and CONNECT BY clauses. You do not have to SELECT the unique key.
    This does not assume that tab1 contains only the row you want to copy.
    As shown, this only works for making multiple copies of a single row.
    The multi-row version isn't much more complicated.

  • My iPad will not charge and every time I charge it. It comes up with the iTunes icon and I will not charge, it is not a new I pad and the same charger I use for the I pad I use for my I phone and it will charge. What is wrong?

    My iPad will not charge and every time I charge it. It comes up with the iTunes icon and I will not charge, it is not a new I pad and the same charger I use for the I pad I use for my I phone and it will charge. What is wrong?

    What exactlyare you seeing on the iPad's screen ? If it's the iTunes icon and a cable then that means that it's gone into recovery mode - you will need to connect it to your computer's iTunes and you should be able to use that to reset it back to factory defaults and you can then restore/resync your content to it.

  • Can I set up multiple usb hard drives- one for time machine and a second for media? Can one also print wirelessly with an old HP C6280 printer?

    Can I set up multiple usb hard drives- one for time machine and a second for media?
    Can one also print wirelessly with an old HP C6280 printer?

    Can I set up multiple usb hard drives- one for time machine and a second for media?
    Yes.
    Can one also print wirelessly with an old HP C6280 printer?
    Possibly by using an Airport Express, but depends on what type of port connection the printer requires.

  • When i log into icloud on my laptop,there is an error displayed? im using the same apple id and password that i use for itunes...helppp

    even do i use the same apple id and password that i use for itunes.

    Hi peacegraffiti,
    Thank you for using Apple Support Communities. 
    I understand you are having difficulties restoring your new iPhone from a previous iCloud backup. The following article provides information to help restore from an iCloud backup. 
    Get help restoring from an iCloud backup - Apple Support
    Cheers,
    Jeff D. 

  • Which quick time should I be using for windows vista?

    which quick time should I be using for windows vista? when I look at the plugins I'm using for Google Chrome Browser there are several listed for Quick Time, do I need them all?

    when I look at the plugins I'm using for Google Chrome Browser there are several listed for Quick Time, do I need them all?
    Yes. The seven different plugin dlls (npqtplugin.dll, ntqtplugin2.dll, etc) each handle various different file formats.

  • Populating Empty Fields for Existing Internal Table Using For All Entries

    I have an internal table called itab_extract that populates without any issues in SELECT A and SELECT B below. Trying to avoid looping, I am using select DB table 'for all entries' in itab_extract. I want the empty fields in itab_extract to populate from the values in the database. However, about 200,000 entries are being appended to the table, and, the values that existed for the already populated fields in itab_extract are gone, and the new fields are populated.
    I've played with the syntax and cannot seem to get it to work. My next option is a time consuming loop.
    How should the for all entries syntax look to accomplish filling the empty fields in the itab?   Thank-You
    *read ekko
        select ebeln lifnr aedat bsart from ekko                                                     *SELECT A*
               into  CORRESPONDING FIELDS OF TABLE me->itab_extract
               where aedat in r_aedat.
        select ebeln lifnr aedat BSART from ekko                                                  *SELECT B*
               appending CORRESPONDING FIELDS OF TABLE me->itab_extract
               where aedat in S_DATE2 AND
                     BSART IN S_BSART.
          select ebelp werks matnr                                                                           *SELECT C*
            into CORRESPONDING FIELDS OF TABLE itab_extract
            from ekpo
            FOR ALL ENTRIES IN itab_extract
            where ebeln = itab_extract-ebeln.

    Hi Tom,
               This SQL statement will be time consuming, Do not use a loop.
    There are two options.
    1. Select EKKO and EKPO details based on standard SAP view. (You can type EKKO in se11 view to find the correct view).
        also use one range table populate r_aedat and s_date2 in the same. So you where condition will have r_newrange and   
        s_bsart. Also do not use into corresponding fields, it is not a good idea. It will increase your performance. Maintain the proper 
        sequence (Based on database structure of EKKO and EKPO)
    2. If you are keen to use for all entries, then first select ekko then after your sy-subrc check get the data from EKPO.
    Should be like this.
    select ebeln bsart aedat lifnr from ekko into table gt_ekko where aedat in r_newrange and bsart in s_bsart.
    if sy-subrc eq 0.
    sort gt_ekko by ebeln ascending.
    select ebeln ebelp werks matnr  into table gt_ekpo for all entries in gt_ekko where ebeln eq gt_ekko-ebeln.
    endif.
    Hope it helps,
    Best Regards,
    Tapodipta Khan.

  • Join 3 tables using FOR ALL ENTRIES

    Hi,
    I want to join 3 tables and show their result in a text file delimited by comma.
    ITs a download program.Can someone tell me how to how to join the three table using for all entires instead of inner join.please give step  by step illustration

    Hi,
    Please check below code which downloads records from 3 tables into excel file.
    if you want other file means you can specify other file type in the fm parameter
    REPORT zstemp_qty2_  LINE-SIZE 255 .
    DATA:it_vbak LIKE vbak OCCURS 0 WITH HEADER LINE.
    DATA:v_file1 LIKE rlgrap-filename.
    DATA:v_file2(80) TYPE c.
    DATA:it_vbap LIKE vbap OCCURS 0 WITH HEADER LINE.
    DATA:it_mara LIKE mara OCCURS 0 WITH HEADER LINE.
    START-OF-SELECTION.
      SELECT * FROM vbak INTO TABLE it_vbak UP TO 100 ROWS.
      IF NOT it_vbak[] IS INITIAL.
        SELECT * FROM vbap INTO TABLE it_vbap
        FOR ALL ENTRIES IN it_vbak
        WHERE vbeln = it_vbak-vbeln.
      ENDIF.
      LOOP AT it_vbap.
        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
             EXPORTING
                  input  = it_vbap-matnr
             IMPORTING
                  output = it_vbap-matnr.
        MODIFY it_vbap TRANSPORTING matnr.CLEAR it_vbap.
      ENDLOOP.
      IF NOT it_vbap[] IS INITIAL.
        SELECT * FROM mara INTO TABLE it_mara
        FOR ALL ENTRIES IN it_vbap
        WHERE matnr = it_vbap-matnr.
      ENDIF.
      CALL FUNCTION 'F4_FILENAME'
       EXPORTING
         program_name        = sy-cprog
         dynpro_number       = sy-dynnr
      FIELD_NAME          = ' '
       IMPORTING
         file_name           = v_file1          .
      v_file2 = v_file1.
      CALL FUNCTION 'WS_DOWNLOAD'
       EXPORTING
      BIN_FILESIZE                  = ' '
      CODEPAGE                      = ' '
         filename                      = v_file2
         filetype                      = 'WK1'
      MODE                          = ' '
      WK1_N_FORMAT                  = ' '
      WK1_N_SIZE                    = ' '
      WK1_T_FORMAT                  = ' '
      WK1_T_SIZE                    = ' '
         col_select                    = '1'
      COL_SELECTMASK                = ' '
      NO_AUTH_CHECK                 = ' '
    IMPORTING
      FILELENGTH                    =
        TABLES
          data_tab                      = it_mara
      FIELDNAMES                    =
    EXCEPTIONS
      FILE_OPEN_ERROR               = 1
      FILE_WRITE_ERROR              = 2
      INVALID_FILESIZE              = 3
      INVALID_TYPE                  = 4
      NO_BATCH                      = 5
      UNKNOWN_ERROR                 = 6
      INVALID_TABLE_WIDTH           = 7
      GUI_REFUSE_FILETRANSFER       = 8
      CUSTOMER_ERROR                = 9
      OTHERS                        = 10
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      LOOP AT it_mara.
        WRITE:/ it_mara-matnr.
      ENDLOOP.
    Regds
    Sivaparvathi
    Please reward points if helpful.....

  • What r the tables used for this report.

    hi all..
    i am a fresher for ABAP. i need the help.
    what r the tables used for this report.
    Reports provide pending order details according to Material wise and customer wise for particular month.
    thanks in advance
    RK.Ashokkumar.

    Hi Ashok,
    this is easy to do.
    Open Two SAP Screen with same user ID.
    Run SQL trace using ST05 transaction.Open ST05 transaction in One and make
    Trace on ,Run the report in another screen.
    Once report run is over.End the trace process and click on display trace in same ST05 transaction.There is a click button on ST05 Transaction screen to start trace
    process,End trace process and Display track process.
    The SQL trace will  give you all the table details which is used in that particular report.
    You have not mentioned about the report name so I have suggested this way.
    regards,nishant
    Please reward if this helps

  • Tables used for Complaints & Activities

    Hello Experts ,
    What are the database tables used for
      Activities & Complaints.
    Points will be assigned.
    Thank You

    CRM online works with the one-order concept, which collects all order-like transactions in the same structures (Database tables and bdocs)
    ==> CRMD_ORDERADM_H
    crmd_orderadm_i
    crmd_partner You can find the transaction partners in table crmd_partner using the guid of the order
    CRMD_ORDER_INDEX( this table has the bp number and process_type )
    Let me know if still needs other tables
    Vijay

  • Tables used for material ledger

    What are the standard tables used for material ledger

    Hi,
    All req. configuration i have defined in last thread...
    The following tables contain data that can appear in the material ledger documents:
    ·        MLHD      Material Ledger Document: Header
    ·        MLIT  Material Ledger Document: Items
    ·        MLPP      Material Ledger Document: Posting Periods and Quantities
    ·        MLPPF    Material Ledger Document: Field Groups (Posting Periods and Quantities)
    ·        MLCR      Material Ledger Document: Currencies and Values
    ·        MLCRF    Material Ledger Document: Field Groups (Currencies and Values)
    ·        MLCRP    Material Ledger Document: Price Change (Currencies, Prices)
    ·        MLMST    Material Ledger Document: Costing Run Header Data
    The following types of material ledger documents are available, differing by transaction type:
    ·        CL     Material Ledger Closing Entries
    ·        UP    Material Ledger Update
    ·        PC    Price Changes
    ·        ST     Single-Level Price Determination
    ·        MS    Multilevel Price Determination
    ·        RE    Material Ledger Data Repairs
    USE :
    Material ledger documents are data that is recorded during each business transaction that is relevant to valuation. You can archive documents for closed periods when they are no longer needed for material price determination or reporting purposes. Archiving the documents deletes them from the database.
    Regards,
    Priyanka.P
    PLS AWARD IF HELPFULL
    Edited by: Priyanka Paltanwale on Aug 7, 2008 9:34 AM

  • What r all the tables  used for the following report

    hai
    what r all the tables  used for the following report
    report:
    <b>
    •     Report that displays all the late shipments in a particular period of time</b>
    send important fields for this tables also
    thanks in advance.

    Hi,
       Imp table are vttk,vttp,vtts.
    Regards
    Amole

  • How to find function module's and tables used for the particulat screen or TCODE?

    Hello Nation,
    I would like to know how to find the  function modules and tables used for the particular screen or TCODE or program.
    Example : I would like know the function module used in the program RDBGFT?
                     How can i find that?
    Thanks in advance ,Awaiting your reply.

    Make use of Find function  with the keyword "CALL FUNCTION".
    Make use of the same find function with the keyword "Select" to know the database tables used.
    Regards,
    Philip.

Maybe you are looking for

  • Mic does not work in Valve ga

    I have a Creative Labs X-Fi Platinum sound card with the li've dri've bay extension. I have tried using the mic input on the soundcard card itself and I have tried using the mic2 inputs and the aux line2 inputs on the dri've bay. I configured the Cre

  • CalDav hosting in the Internet for iCal and Others

    Hi there We'd like to synchronize (read/write) our calendars online. (2-3 Users) Systems: - OS X 10.5.1 & ICal - Linux with iE. Mozilla Calendar - Anything with a Browser from the internet Needed functionality: - Hosted in the internet (not by us) wi

  • Print out of GI inspection sheet

    I am facing one problem from an user pertaining to automatic print out of GI inspection sheet.Here first goods receipt takes place with movement type 103 and then goods are placed into unrestricted stock through movement type 105(placing material int

  • Problem with Versions/Auto Save

    Something is awfully wrong with Versions on my system. To note, this happened AFTER the 10.7.1 update, but I can't say whether it happened DIRECTLY after the update. I've already repaired disk permissions using the Recovery Disk. Here's the problem:

  • Hot iBook, fan comes on for first time, could it be 10.4.5?

    I recently upgraded to OS 10.4.5. In the last few days, I've noticed that the fan is coming on. It never did that before. In some cases, it seems to happen when the system is indexing the external hard drive. But the odd thing is--the front left top