Need help with debugging collection in bulk and loop forall

Hi people,

I was wondering if someone can look at my PL/SQL code and tell me where I'm wrong.

Environment
=========
10g (Rel 2)

Algorithm of
=======

A slider lets collect records
The data block
Bulk insert the data into a table

Implementation
==========

Set serveroutput on;

declare

cursor source_cur is
Select * from
from t1;

-Define the variables and collection types to be used by the BULK COLLECT clause

source_data_type type is the table of the source_cur % rowtype;

source_data_table source_data_type;

Start

Open source_cur;
loop
extraction source_cur
bulk collect into source_data_table;

When the output source_data_table.count = 0;

-Now, we print the data collected
-for i in source_data_table.first... source_data_table. Last
-loop
-dbms_output.put_line (' company name: ' | source_data_table (i).) Company);
-dbms_output.put_line ('Count: ' | source_data_table.) (COUNT);
-end loop;
end loop;
close source_cur;


Note: The statements above Print print the correct data and County

-Now, bulk insert us the data into the target table

dbms_output.put_line ('Count: ' | source_data_table.) (COUNT);

Note: The print statement above indicates a number 0 =. Since there is no available record, FORALL loop below will not insert anything in the table

ForAll idx in source_data_table. FIRST... source_data_table. LAST
Insert into T2
source_data_table (idx) values;
end;
/


Thanks in advance

rogers42

You'll want to do something like this

open source_cur;
loop
fetch source_cur
bulk collect into source_data_table;

exit when source_data_table.count = 0;

forall idx in source_data_table.FIRST .. source_data_table.LAST
insert into T2
values source_data_table(idx);
end loop;
close source_cur;

or even better:

insert into target
select col, col, col
  from source

no need to COLLECT in BULK and FORALL
;)

Tags: Database

Similar Questions

  • Need help with Sprite´s. (Rectangles and circle)

    Hello!

    I kinda need help with a project. I m supposed to do a script that responds to a click and moves the circle of one rectangle to another.

    (Here's a picture)

    howtosprite.JPG

    So, what I want is: when I click on the blue rectangle to the right, the circle must move instantly in the rectangle on the right. And same thing on the opposite path.

    Thanks in advance!

    -Best regards,.

    Aleksandar "Dyxir" B.

    import flash.events.MouseEvent;

    leftRec.addEventListener (MouseEvent.CLICK, fCircle);
    rightRec.addEventListener (MouseEvent.CLICK, fCircle);

    function fCircle(evt:MouseEvent)
    {
    Circle.x = evt.currentTarget.x;
    Circle.y = evt.currentTarget.y;
    }

    Note: Point for all alignment: Center

  • Need help with parallax effect - Adobe MUSE and Safari

    Hey there,

    I need help.

    I did a parallax effect on my www.bloxmix.depage.

    Firefox, Opera and Chrome are working very well.

    Safari works worst.

    Try and see.

    Can someone help to solve my problem?

    Thank you community

    Hi Karl,

    Given that the site works fine at my end, I guess the problem is with your local browser. Could you please try it on another computer and see if it works fine here or not?

    - Abhishek Maurya

  • Need help with the classes of structure and folders!

    Hello all :)
    I've been programming some time in Actionscript 3 now. But most of the time I did not so much major projects. So I just had 1 folder with the Fla and class and other classes for different objects. But yesterday, I discovered that I need some more when structuring projects is growing. So what I would like is to have the main file with fla and a file in this folder with the classes or something. But I can't understand it. Searched around the web and Yes tried many things. So now, I have discovered that I need help to solve this problem :)!
    Hope someon can help me with this one, it should be pretty easy, but I understand it now.

    Thanks to !

    You have assigned the MainAs as the file MainFLA.fla document class?

    You have an object in the library that is linked to the class 'Classes.Animal '?

    I would like to declare the variable of animal1 where you have one, but I would not instantiate until, within the service of MainAs.

    SerializableAttribute public class extends MovieClip {} MainAs

    public var animal1:Animal;

    public void MainAs() {}

    the constructor code

    animal1 = new Animal();

    addChild (animal1);

    }

    Is the code that show you for the placement of the Animal object a typo or do you really have it assign the property x twice?

  • Need help with my Toshiba remote control and receiver for Qosmio G30 161

    Hi all

    I have a Toshiba Qosmio G30-161 and with her, I have a Toshiba remote and a Toshiba remote control receiver, this is the first time that I used it (tried of that is), my problem is that the remote control does not work on the computer, when I press keys on the computer program does nothing.

    I installed four new AA batteries and the remote works fine its send signals to the receiver, the receiver of the remote control as a red light detection is displayed whenever you press a button and with regard to the computer, I checked the drivers and the USB is off the hook as a remote E-reception receiver which I checked with Toshiba and which is correct , so overall the remote control works, the receiver is picking up signals and the pc has detected the receiver but nothing works, I have installed remote control manager but was still nothing done to. I talked about support and assistance of Toshiba, and the end result is that they are not sure what is the problem. Can anyone help I need the remote control for the slide shows for clients like ja? m a photographer.

    Also to confirm that I'm under addition of Windows XP MCE.

    Anthony Worlock

    Hello

    This remote will work, if you use it without any special drivers and special software, only in the Media Center.

    But if you install stuff like [WinLirc | winlirc.sourceforge .net] then you should be able to get some functions for your presentation.

    Please try this tool and check if it works.

    By the way: if I were you I would first read the manual and the WinLirc FAQ before you start because it s a little bit tricky to manage the program. :) (Too many parameters: D)

    Welcome them

  • Need help with Windows Live Movie Maker and DVD Maker

    I have worked with Windows Live Movie Maker to cut a continuous piece of video footage into separate clips (these are dance performances by dancers of different about 13)... then once they were divided into 13 clips separated, I then cut them at the beginning and at the end of each clip (performance) and then used legends at the beginning of each clip with name of the dancer.  I also added a title at the beginning of the film page, and I added at the end of the credits.  Then I clicked on save the movie and had to wait an hour or more... Finally, when this was done, I opened Windows DVD Maker and clicked on add items... went to my file and put my film recorded in the creation of DVD.  I used also changed the Menu template to that for shows (it is red and black and has lights and cameras as a staging.  I thought everything was going along fine until I played the disc engraved on my Smart TV DVD player.  For some reason when I click on the stages (or chapters) to see the performance under this button, it starts to play the dvd in a few seconds or a few minutes in some cases in the performance... I've lost countless blank DVDs not to mention hours and hours of time... and I'm so frustrated... I'm ready to SCREEEAAMMM!  Also some of the performances were not even under one of the buttons or frames... in other words you could not use the arrow keys to locate some of them to click it and find out.  Yet, when I went back and pressed the 'Play' button, I could fast forward through the entire movie and find performances that seem to be missing the scenes/buttons.  Any help or advice before I blow a bridge! ???

    Thank you.

    /PR

    I have worked with Windows Live Movie Maker to cut a continuous piece of video footage into separate clips (these are dance performances by dancers of different about 13)... then once they were divided into 13 clips separated, I then cut them at the beginning and at the end of each clip (performance) and then used legends at the beginning of each clip with name of the dancer.  I also added a title at the beginning of the film page, and I added at the end of the credits.  Then I clicked on save the movie and had to wait an hour or more... Finally, when this was done, I opened Windows DVD Maker and clicked on add items... went to my file and put my film recorded in the creation of DVD.  I used also changed the Menu template to that for shows (it is red and black and has lights and cameras as a staging.  I thought everything was going along fine until I played the disc engraved on my Smart TV DVD player.  For some reason when I click on the stages (or chapters) to see the performance under this button, it starts to play the dvd in a few seconds or a few minutes in some cases in the performance... I've lost countless blank DVDs not to mention hours and hours of time... and I'm so frustrated... I'm ready to SCREEEAAMMM!  Also some of the performances were not even under one of the buttons or frames... in other words you could not use the arrow keys to locate some of them to click it and find out.  Yet, when I went back and pressed the 'Play' button, I could fast forward through the entire movie and find performances that seem to be missing the scenes/buttons.  Any help or advice before I blow a bridge! ???

    Thank you.

    /PR

    ===============================================
    First of all a question... did you you save the project in a video such as format
    . WMV or. MP4? Or have you just of WLMP project folder?

    I suspect that DVD Maker is to see your movie in one file
    and he has no idea where are your scenes. More than likely it is
    creation of scenes on his own in arbitrary places.

    In order for DVD Maker correctly, identify individual scenes
    each stage must be registered as an individual video clip, then
    the collection of video clips can be imported and each of them must
    become an individual scene.  DVD Maker is supposed to accept
    up to 18 scenes.

    Just an experience you can import your new original
    video clips in DVD Maker and see if it works properly. If
    It does what you want... change and re-record your clips one video
    both will be the fix.

    Good luck...

  • Need help with my LAN adapter wireless and cable.

    After I installed Windows 7 I have experienced the following problem, connected my Acer Aspire 4736z laptop to the internet.

    After a long period of maintenance of the computer to be idle, eg.in standby or hybernation. the adapter LAN and Wifi Adapater is unable to detect. So I have to restart the computer to make it work. I tried updating the driver but it says that the system already has the latest software. but this happens every time the the computer to sleep and wakes up.

    the drivers for the hardware istalled are Atheros AR5B91 Wireless Network adapt and Atheros AR8121/AR8113/AR8114 PCI - E Ethernet Controller and Microsoft Virtual Wifi Miniport Adapter.

    Windows Network Diagnostics

    Problem encountered There might be a problem with the driver for the Wireless N...

    Detected configurecomplete wireless network adapter

    The wireless network adapter problemscompleted

    There might be a problem with the driver for the region...

    Detected configure the cable networkover the wired network adapter card problemscompleted

    Problems found

    <>There might be a problem with the driver for the wireless network connection card Windows could not automatically bind the Protocol IP on the network card stack.

    Detected

    Configure the wireless network adapter Configure the network adapter to communicate with the network. This ensures that the Internet Protocol Version 4 (TCP/IPv4) and Internet Protocol Version 6 (TCP/IPv6) can be used on the network adapter.

    <>There might be a problem with the driver for the connection to the Local network map Windows could not automatically bind the Protocol IP on the network card stack.

    Completed

    Network Diagnostics log file name: E86CD671-170C-42B3-B6F7-7DB88F9B6343. Repair.Admin.3.etl

    The wireless network adapter problems Windows Help and Support can provide more information about the resolution of driver or hardware problems.

    Completed

    Detected

    Set up the wired network adapter Configure the network adapter to communicate with the network. This ensures that the Internet Protocol Version 4 (TCP/IPv4) and Internet Protocol Version 6 (TCP/IPv6) can be used on the network adapter.

    Completed

    Network Diagnostics log file name: BFE9A7EC-918C-4453-B383-C45DEB6332D6. Repair.Admin.0.etl

    The wired network adapter problems Windows Help and Support can provide more information about the resolution of driver or hardware problems.

    the problem is solved, but I did not try anything. It seems he healed it self, can be via windows update something. Thank you guys

  • IP number looking for PSI - need help with a sql solution better and faster

    Hello

    I have a table (one) with more 1 000 000 IP addresses and numbers (the digital equivalent of the IP address)

    I have a second table (b) which contains a mapping between the ranges of the ISP and IP. The table looks like this and more contains 150 000 entries:

    BEGIN_IP_RANGE END_IP_RANGE ISP_NAME

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

    600000000 700000000 ISP_X

    800000000 900000000 ISP_Y

    I'm creating a third table (c) which connects (a) IP numbers to identify the ISP from (B). The query looks like this:

    CREATE TABLE c

    AS

    Select a.IP_ADDRESS

    b.ISP_NAME

    IP_NUMBERS a, ISP_LOOKUP b lkp

    where a.IP_NUMBER between b.BEGIN_IP_RANGE and b.END_IP_RANGE

    ;

    There is no key join between the 2 tables and so I use TO search for the access provider. The performace of it's terrible and table (c) takes several hours to create.

    Does anyone have any thoughts/ideas/suggestions on how this research can be achieved by using a solution better and faster?

    Thank you very much

    Shah

    The performace of it's terrible and table (c) takes several hours to create.

    Hours what do you say?

    See if the following can help.

    Cardinalities are similar to yours. The ETG takes 7sec. :

    SQL> create table ip_numbers (ip_address, ip_number) as
      2  select cast(to_char(level,'fm099G999G999G999', 'nls_numeric_characters=,.') as varchar2(15))
      3       , level
      4  from dual
      5  connect by level <= 1000000 ;
    
    Table created.
    
    SQL> select * from ip_numbers where rownum <= 10;
    
    IP_ADDRESS       IP_NUMBER
    --------------- ----------
    000.000.000.001          1
    000.000.000.002          2
    000.000.000.003          3
    000.000.000.004          4
    000.000.000.005          5
    000.000.000.006          6
    000.000.000.007          7
    000.000.000.008          8
    000.000.000.009          9
    000.000.000.010         10
    
    10 rows selected.
    
    SQL>
    SQL> create table isp_lookup (begin_ip_range, end_ip_range, isp_name) as
      2  select 1 + (level-1)*5
      3       , level*5
      4       , cast('ISP_'||to_char(level,'fm099999') as varchar2(10))
      5  from dual
      6  connect by level <= 200000 ;
    
    Table created.
    
    SQL> select * from isp_lookup where rownum <= 10;
    
    BEGIN_IP_RANGE END_IP_RANGE ISP_NAME
    -------------- ------------ ----------
                 1            5 ISP_000001
                 6           10 ISP_000002
                11           15 ISP_000003
                16           20 ISP_000004
                21           25 ISP_000005
                26           30 ISP_000006
                31           35 ISP_000007
                36           40 ISP_000008
                41           45 ISP_000009
                46           50 ISP_000010
    
    10 rows selected.
    
    SQL> create index ip_address_number_ix on ip_numbers (ip_number);
    
    Index created.
    
    SQL> set timing on
    SQL>
    SQL> create table ip_mappings as
      2  select /*+ use_nl(a b) */
      3         a.ip_address
      4       , b.isp_name
      5  from isp_lookup b
      6       join ip_numbers a on a.ip_number between b.begin_ip_range
      7                                            and b.end_ip_range
      8  ;
    
    Table created.
    
    Elapsed: 00:00:06.94
    SQL> select count(*) from ip_mappings;
    
      COUNT(*)
    ----------
       1000000
    
    Elapsed: 00:00:01.22
    
  • Need help with vSphere data script, packaging and sending it to the data warehouse

    Greetings PowerCLI gurus.


    Everyone can offer suggestions on a script which can query vSphere and pull on the following fields of the virtual computer:

    NameStateStatusHostSpace in useSpace used

    Format in a file in the CSV format and send the file to an FTP server?

    Much respect to all, thanks a lot in advance.

    Hello-

    Happy to help you.

    OK, well, if this database is accessible through a UNC path, you might make a copy directly using Copy-Item.  If you use different credentials, you can encrypt and store in an XML file.  HAL Rottenberg wrote to do http://halr9000.com/article/531.

    Or, if this pension data is something that supports the secure copy (scp) or secure FTP (SFTP), those who would be good options.  Again, you can store the alternative credentials in an encrypted in an XML file format and use them as needed.

    Certainly, there is a balance to be struck between security and ease of use.  It may be such that the transmitted data are not considered sensitive to all, and clear data transfers are acceptable.  Probably still a good idea to take measures to protect the credentials at least.

  • Need help for debugging CSS for IE6 and IE7

    I'd appreciate anyone with a bit of free time to give another pair of eyes. I tried a number of hacks found on this forum and other places to ensure that IE plays well with this site of two columns, I've been thinking, but according to BrowserLabs, there are still problems with IE6 and IE7. Naturally, all other browsers, including IE8 (!), goes as planned.

    The initial attempt, I settled on is here: http://www.patriciayoungquist.com/pages/public/welcome.html . (This page is representative, as all other internal pages are built the same way.) According to BrowserLabs, pageContent and copyright divs rather than show beside and below (respectively) drop-in IE6 and IE7. I still think there's a simple solution here, but I was not able to hit on him

    So I started a new model and CSS to see if I could work out another way and came with http://www.patriciayoungquist.com/pages/test/PYPAtemplate.html . Curiously, this still works in all and now works in IE6 but not in IE7. In IE7, the sidebar is displayed on top of the pageContent.

    I don't know there is something obvious that I'm missing. Work in CS4, and I know the pages validate. So, if anyone has any suggestions, I'd like to try.

    Thank you

    Chris

    Using your first link as an example, I see several things that are not fair.

    (1) do not use positioning.  For the majority of your layout of the site, you must use default CSS that is not positioning at all.

    (2) a fixed positioning does not work in older IE on any container except the body.  It's playing havoc with your left sidebar.  Solution is to remove position: fixed and replace by float: left.  In addition, you may need to add a clearing for your footer float.

    (3) height is a restriction.  Remove height of containers with text in them.

    (4) to align elements on the page, use the margins, padding, or floats - not absolute, fixed or relative positioning.

    Learn CSS positioning in 10 easy steps-
    http://www.Barelyfitz.com/screencast/HTML-training/CSS/positioning/

    Float tutorials-

    http://CSS.maxdesign.com.au/Floatutorial/

    Nancy O.
    ALT-Web Design & Publishing
    Web | Graphics | Print | Media specialists
    http://ALT-Web.com/
    http://Twitter.com/ALTWEB

  • Need help with the update server behaviors and deleting records

    I am 'trying' to use the update and delete record server behaviors and I can't get the redirection page to set up correctly. What I'm trying to do, is to have the redirection came up with the right records depending on the CompId page. It seems that it is taking the CompId and agreementId (which are my unique ID) and use them in the url of the redirection page. Also, it updates the table. Here is the url that appears after I have send the update:

    http://localhost:8888/dotweb/maintenance/agreement_home.php?CompId= & agreementId = 7

    Here is the code for the update page:

    Name of the document
    Signed?
    First name
    Family name
    Date of signature

    Pending patent, trade mark, Tradesecret and straightened to copy recorded
    Copyright KML designs 2009

    Can someone tell me why it would show the CompId and agreementId when everything I asked the CompId? Thanks for your help. Just in case, I enclose you an html version of this file. It must be a php file, but is not one of the allowed file types.

    CompId is not filled in the URL because you try to use the result of the rsAgree recordset object until the result of the recordset is created. However, you pass the CompId value via array $_POST as a hidden field.

    Change this line (52):

    $updateGoTo = "agreement_home.php?CompId=" . $row_rsAgree['CompId'] . "";
    

    to do this:

    $updateGoTo = "agreement_home.php?CompId=" . $_POST['CompId'];
    
  • Need help with sql query involving distinct and County

    I have 2 tables and I want to get the number of specific names. Find the details below. It's hard to explain but I will try to provide as much detail as I can.

    Table A:
    ID of the SR
    1001 1
    1002 2
    2 1003
    1004 3


    Table B:
    Name of the key SrNew
    1 David 1001
    2 James 1002
    3 James 1002
    4 James 1003
    5 James 1004
    6 Mike 1004

    Result: I'm looking:
    Count names such as if the name appears for the same ID of Table A two times, and then only count 1.

    Name of County
    David 1
    James 2 (1002 and 1003 for the same ID (ID #2) so count as 1 for this and then 1 more for 1004 and ID 3)
    1 Mike


    I have following question:
    SELECT distinct (b.Name), a.ID
    FROM TableA, TableB b
    Where a.Sr = b.SrNew Group By b.Name, a.ID

    and as a result I get:
    ID name
    David 1
    James 2
    3 James
    3 Mike


    Now, I want to just the number of each name with the result, but don't know how I can do this with a sql?

    Thanks in advance.

    Who help me?

    SELECT b.Name, count(distinct a.ID)
    FROM TableA a, TableB b
    Where a.Sr = b.SrNew
    Group By b.Name
    

    Nicolas.

  • New to pix, need help with "debug access list of all the" command

    I have a pix 515 v6.3. I am tring to use then "debug access list of all the" command to see what traffic is stopped by my access list. However, I don't get any output. I turn execution of the command, but nothing happens. Other debug commands give the console. Perhaps, I do not understand what "debug to access list of all the" is used for. Any help that can be provided would be greatly appreciated.

    Tim

    Also try following the commands of logging

    LOGG on

    LOGG buff 7

    term Lun

    M.

  • Need help with apex listener administration username and passwd

    Hello
    I downloaded apex ODD and tried lunch listener admin http://localhost: 8888/apex/listenerAdmin
    Help me please the username and password.
    Thank you very much.

    Hailt wrote:
    Hello
    I downloaded apex ODD and tried to lunch listener admin http://localhost: 8888/apex/listenerAdmin
    Help me please the username and password.
    Thank you very much.

    (1) do not not eating a listener. It is not good for you.
    (2) you are sure that you are in the right forum for this? (You may be... but you may very well not be)... If ODD is open developer day information about passwords are usually in the installation instructions.

    .. I don't remember having to worry of the Auditors of the apex, but I havant used the latest versions...

    The main objective of how to post to fix your possible eating disorder.

  • Need help with smart Collections (Lightroom 2.7)

    I'm trying to implement a smart collection to list files that are empty in the location field.  Some areas such as the legend allow you to check if the field is 'empty '.  Location does not have the option 'is empty.  What can I do to check if the slot is empty or empty?

    Does not contain an e i o u.

    Yes, it's stupid that you have need of these workarounds.

Maybe you are looking for

  • Send SMS in landscape mode

    My iPhone 6 s freezes when I text in landscape mode.  If I switch to portrait mode, it works fine.  I prefer the text mode landscape with both hands.  My orientation lock is not on. Any suggestions? iPhone 6 s Model: MKQ92LL/A Version: 9.3.4

  • Satellite P10: Question about the limits of upgrade of RAM and HARD drive

    What are the limits to upgrade my laptop Satellite P10? Currently, I use 1 GB of RAM (2 x 512) and I still have the original 60 GB 4200 RPM HARD drive. I'm mainly interested in upgrading my hard drive to at least get a 7200 RPM 100 GB disc. Better wo

  • My macbook pro does not detect my s6 (connected via USB). How can I solve this problem

    I tired to connect my phone using the usb cable, macbook pro does not detect my phone as a media device, but the phone is charged. Y at - it a patch or an app, I need for macbook pro to detect my phone. Thank you

  • DASYLab 5.6 will work with one nor 9171

    I have a NI USB 9171 a universal module with an older version of DASYE Lab 5.6, I have not yet loaded the software. But I was owndering if the Dasylab will work with automation of the measurement? I installed the MY LabView Signal Express, it is just

  • Pavilion dv7t-6100-cto-quad: I can't get the new drivers on the hp support site

    I have restored my ssd from disks that I made the computer when I bought it and I did everything I know to do and can not get the hp support site to give me a list of drivers for that computer. I know there must be some updated drivers for the comput