Code Doesn't Run - Not Sure Why.....

Hello Everyone:
I have an Oracle “program” (I wouldn’t call it a program, but just some code for a one off move of data). I use TORA as the interface for Oracle. I do not have a copy of TOAD. But for some reason, when I run this code, it takes all of 0.003 seconds and doesn’t actually move any data. Below is a copy of the code. If I take the query being used in the cursor, it does return data and takes about 1.5 seconds to execute, but when trying to run this code, it takes 1/10th of that time, so I am doing something wrong but I can’t figure out what.
I also tried to copy this code into SQLPlus, but that also does not run. Can anyone spot what I am doing wrong? I am not sure if it is my environment and how I am trying to run this or the code itself is flawed.
DECLARE
-- Local Variables
l_gm_master_label VARCHAR2(20);
l_active_flag VARCHAR2(1);
l_currdate DATE;
l_comp_id VARCHAR2(2);
l_site_id VARCHAR2(2);
l_gm_master_id NUMBER;
c_serial_number VARCHAR(40);
c_creation_date DATE;
c_interface_date DATE;
c_ebiz_sku_no NUMBER;
c_ebiz_ord_no NUMBER;
-- Cursor
CURSOR serial_number_data IS
SELECT
S.serial_number,
S.creation_date,
S.interface_date,
S.ebiz_sku_no,
O.ebiz_ord_no
FROM
dmlogic.trn_rm_serial_number S
INNER JOIN ebiznet.trn_ordhead O ON S.ord_no = O.ord_no;
BEGIN
DBMS_OUTPUT.ENABLE(2000);
-- Set default values
l_gm_master_label := 'DMLogic001';
l_active_flag := 'N';
l_currdate := SYSDATE;
l_comp_id := 'XE';
l_site_id := 'OHIO';
l_gm_master_id := 0;
-- Get the next value
SELECT
trn_gm_master_seq.NEXTVAL
INTO
l_gm_master_id
FROM
dual;
-- Insert generic Gray Number master record that will be joined to all the DMLogic serial numbers
INSERT INTO trn_gm_master
(gm_master_id,
gm_master_label,
active_flag,
currdate,
comp_id,
site_id)
VALUES
(l_gm_master_id,
l_gm_master_label,
l_active_flag,
l_currdate,
l_comp_id,
l_site_id);
-- Open the cursor
OPEN serial_number_data;
LOOP
-- Fetch the values
FETCH serial_number_data INTO c_serial_number, c_creation_date, c_interface_date, c_ebiz_sku_no, c_ebiz_ord_no;
EXIT WHEN serial_number_data%NOTFOUND;
INSERT INTO ebiznet.trn_gm_serial_number
(gm_serial_number_id,
gm_master_id,
gm_serial_number,
received_by,
received_date,
picked_by,
picked_date,
ebiz_sku_no,
comp_id,
site_id,
ebiz_ord_no,
interface_date)
VALUES
(trn_gm_serial_number_seq.NEXTVAL,
l_gm_master_id,
c_serial_number,
1,
c_creation_date,
1,
c_creation_date,
c_ebiz_sku_no,
l_comp_id,
l_site_id,
c_ebiz_ord_no,
c_interface_date);
EXIT WHEN serial_number_data%NOTFOUND;
END LOOP;
CLOSE serial_number_data;
-- Commit the changes
COMMIT;
-- Rollback if an error has occured
EXCEPTION
WHEN OTHERS THEN
ROLLBACK;
DBMS_OUTPUT.PUT_LINE('ERROR HAS OCCURED');
END;

When running it in SQL Plus, remember to put the / at the end of the script;
Also, remember to print out your error in your exception handler;
DECLARE
  -- Local Variables
  l_gm_master_label VARCHAR2(20);
  l_active_flag VARCHAR2(1);
  l_currdate DATE;
  l_comp_id VARCHAR2(2);
  l_site_id VARCHAR2(2);
  l_gm_master_id NUMBER;
  c_serial_number VARCHAR(40);
  c_creation_date DATE;
  c_interface_date DATE;
  c_ebiz_sku_no NUMBER;
  c_ebiz_ord_no NUMBER;
  -- Cursor
  CURSOR serial_number_data IS
    SELECT
      S.serial_number,
      S.creation_date,
      S.interface_date,
      S.ebiz_sku_no,
      O.ebiz_ord_no
    FROM
      dmlogic.trn_rm_serial_number S
    INNER JOIN ebiznet.trn_ordhead O ON S.ord_no = O.ord_no;
BEGIN
  DBMS_OUTPUT.ENABLE(2000);
  -- Set default values
  l_gm_master_label := 'DMLogic001';
  l_active_flag := 'N';
  l_currdate := SYSDATE;
  l_comp_id := 'XE';
  l_site_id := 'OHIO';
  l_gm_master_id := 0;
  -- Get the next value
  SELECT trn_gm_master_seq.NEXTVAL
  INTO   l_gm_master_id
  FROM   dual;
  -- Insert generic Gray Number master record that will be joined to all the DMLogic serial numbers
  INSERT INTO trn_gm_master
            (gm_master_id,
            gm_master_label,
            active_flag,
            currdate,
            comp_id,
            site_id)
            VALUES
            (l_gm_master_id,
            l_gm_master_label,
            l_active_flag,
            l_currdate,
            l_comp_id,
            l_site_id);
  -- Open the cursor
  OPEN serial_number_data;
  LOOP
    -- Fetch the values
    FETCH serial_number_data INTO c_serial_number
                                 ,c_creation_date
                                 ,c_interface_date
                                 ,c_ebiz_sku_no
                                 ,c_ebiz_ord_no;
    EXIT WHEN serial_number_data%NOTFOUND;
    INSERT INTO ebiznet.trn_gm_serial_number
                (gm_serial_number_id,
                gm_master_id,
                gm_serial_number,
                received_by,
                received_date,
                picked_by,
                picked_date,
                ebiz_sku_no,
                comp_id,
                site_id,
                ebiz_ord_no,
                interface_date)
                VALUES
                (trn_gm_serial_number_seq.NEXTVAL,
                l_gm_master_id,
                c_serial_number,
                1,
                c_creation_date,
                1,
                c_creation_date,
                c_ebiz_sku_no,
                l_comp_id,
                l_site_id,
                c_ebiz_ord_no,
                c_interface_date);
    EXIT WHEN serial_number_data%NOTFOUND;
  END LOOP;
  CLOSE serial_number_data;
  -- Commit the changes
  COMMIT;
  -- Rollback if an error has occured
  EXCEPTION
    WHEN OTHERS THEN
    ROLLBACK;
    DBMS_OUTPUT.PUT_LINE('ERROR HAS OCCURED ' || sqlerrm);
END;
/

Similar Messages

  • [solved] My udev rule for my Android phone doesn't work, not sure why

    I have the HTC G1 Android phone and I'm trying to get a udev rule working for it.  This is my rule ...
    /etc/udev/rules.d/50-android.rules
    SUBSYSTEM=="usb_device", SYSFS{idVendor}=="0bb4", MODE="0666", NAME=="android"
    ... but when I connect my phone, /dev/android doesn't appear.  0bb4 is correct ...
    /sys/class/usb_device/usbdev5.2/device/idVendor
    0bb4
    ... so what's going on?
    Last edited by synthead (2008-11-28 15:19:09)

    There is, but I can already use it that way.  I'm learning how to code in java so I can develop applications for it.  There's a feature in the SDK where you can install and run your code on your Android device fairly seamlessly.  You literally hit "Run" and a few moments later, your phone's going to town.  But for this to work, permissions need to be set (0666).  But my udev rule does nothing and I dont understand why.
    This is where I got this information: http://code.google.com/android/intro/de … cehardware

  • I Download Flash And It Doesn't Run Not Sure How To Fix

    I have a IMac OS X 32 bit and what happens is that this computer is brand new, and I have to download flash for the first time, I think.
    Every time I download the Adobe Flash App for Mac it loads and says it is successful but when I try and go to say Youtube and run a video it says I still need
    to download the Flash App all over. Iv tried restarting my computer after and its the same thing. Iv contacted live chat and called and they say its a tech issue and referred me here to the forums. Is anyone having the same issue and has any help on how I might resolve this issue. Any help would be greatly appreciated.
    Regards,
    xxahughxx

    Hi, Now after you download it, you need to Install it. Did you do that?
    If you are using Safari, go to this test site and let me know if you can see the Flash Player logo(Red F) animation(spin)
    What version if any of Flash Player is displayed? http://www.adobe.com/software/flash/about/
    The Flash Player Installer also Installs a Shockwave Flash plugin into the browser. Is that there and Enabled?
    Finally, this Troubleshooting Guide for Mac may help you.
    http://kb2.adobe.com/cps/865/cpsid_86551.html
    Hope this helps.
    eidnolb

  • I am walking through Apples tutorial getting started with iOS development. I am at the storyboard area and can't seem to drag the cancel button to the green exit. I am not sure why the exit button doesn't except it. Is anyone else having this issue?

    I am walking through Apples tutorial getting started with iOS development. I am at the storyboard area and can't seem to drag the cancel button to the green exit. I am not sure why the exit button doesn't except it. Is anyone else having this issue? Is there a work around? I have done this app twice and still cant get the exit to except the Cancel or Done  bar buttons

    Yes I checked it.  As far as I can see I did everything Apple said to do.  I took some screen shot so you can see how the screens are connected and what and where the code is, and what it does when I drag the cancel and done bar buttons to the exit

  • I received a text today while at work about iCloud keychain verification code. I have not signed up for it or anything that uses it. I work out of the city with limited internet access so not sure why I would be getting this. Is my info safe??

    I received a text today while at work about iCloud keychain verification code. I have not signed up for it or anything that uses it. I work out of the city with limited internet access so not sure why I would be getting this. I only got this number about a month ago. Apparently someone else had the number before because I get texts from his family members wondering whats going on. I got one yesterday and the person didn't seem to thrilled that the number was cutoff and today I got 2 texts about iCloud Keychain which I don't even know what it is. Seems suspicious to me. If the person who use to own the number is doing it he should know it is not his number anymore because he obviously didn't pay his bills.  I'm not too sure about iCloud Keychain so just want to know my info safe?? It says it can store credit card numbers which is what gets me worried. Frankly I think it's pretty stupid to save that kind if information with any kind of app. But I don't want some random person trying to access my personal information because they are bitter they lost their number.  Please let me know as soon as possible so I can change passwords or anything that is needed.
    thanks

    If it were me, I would go to my carrier and get a new number. Since you have only had it for a month, the inconvenience would be minimal.
    Barry

  • My photoshop cs6 seems to be running very slow lately--not sure why? [was:question-please help]

    My photoshop cs6 seems to be running very slow lately--not sure why?

    Have you tried resetting your PRAM?
    Shut the Mac down.
    Holding the Cmd+Opt+P+R keys, press the power button.
    Listen for the "startup chime" to sound three times and release the keys.
    It should run better after it finishes booting up.

  • I have mac book 2,1 running 10.6.8 but unable to upgrade to maverick, not sure why

    I have macbook 2,1 running 10.6.8 would like to upgrade to maverick but get message unable to upgrade my computer, not sure why.

    Your computer’s EFI is 32-bit. It can’t be upgraded past 10.7.5.
    (110325)

  • Since iOS 7.1 my phone won't turn on and is asking me to connect to iTunes. I connect to itunes and it says it needs to be restored. Not sure why. I try to restore it and then it says something went wrong and it won't work. So I've been without my phone

    Since iOS 7.1 my phone won't turn on and is asking me to connect to iTunes. I connect to itunes and it says it needs to be restored. Not sure why. I try to restore it and then it says something went wrong and it won't work. So I've been without my phone for a couple days now. It gives me error code (29). The phone almost reboots and then 3/4 of the way through it gives me the error message.

    If using windows...
    Temporarily disable your firewall and antivirus software and try again...
    http://support.apple.com/kb/TS1379
    See iTunes Connection Issues here...
    iTunes for Windows: Troubleshooting security software issues
    NOTE:
    Make sure you have the Latest Version of iTunes (v11.1.5) Installed on your computer
    iTunes free download from www.itunes.com/download

  • From some reason (i'm not sure why..) my whole iphoto library got deleted. I restored the whole library from my backup. The photos are blank but steel have the photo info. (date, res., size etc.) Do you know what's the prob.? why can't i see my pics.

    from some reason (i'm not sure why..) my whole iphoto library got deleted. I restored the whole library from my backup. Now all the photos are blank but steel have the photo info. (date, res., size etc.) Do you know what's the prob.? why can't i see my pics.

    It's says that file does not exist. How come? And why does it still show the image info.?
    Where can i find those files (i have a daily backup)
    The original image files are missing form your iPhoto library or iPhoto cannot find them, because the link to the originals has been broken. The image info is stored in the internal libraries, independent of the original files. That is, why you are still seeing them.
    I restored the whole library from my backup.
    Try restoring from an older backup, from before you first noticed the problem. 
    How large is the library, that you restored? Is the file size large enough to hold all your photos, or has the size been reduced?  If the library is still large, the photos may still be inside, even if iPhoto cannot find them.
    It's says that file does not exist. How come?
    What happened, before your iPhoto library got deleted? Which applications have you been running, or which new software have installed or upgraded?  Have you moved the library to a different disk or tried to use it from different user account or access it over the network?

  • Servlets can't access Oracle9i database - not sure why?

    Hi there,
    I got an error when it throws a SQLException in my Internet Explorer.
    Error:
    ======
    SQLException: Io exception: The Network Adapter could not establish the connection
    Is it bcs i uses scott/tiger?
    I places classes12.zip into c:\oraclejdbc
    and place this in my classpath:
    .;c:\oraclejdbc\classes12.zip;
    *Note: I places classes12.jar (also can't work)
    Then for a backup reason
    I go to C:\Tomcat5\common\classes
    and extract the classes12.zip in there
    i can see javax and oracle folders
    Then.. i make sure in my java codes (no compile error)
    java:oracle:thin@wenching:1521:wenching
    i was pointing to the right pc name and oracle server ID.
    Then i call my servlets into my j2me phone...
    it display all the necessary information.. on the data that should be extracted from the oracle 9i database.. display java.sql.SQLException...
    There are something wrong?
    Can you tell me what i left out? My servlets are working fine?
    But i had 2 java files...
    WebPage.java calls OracleConn.java
    and in web.xml
    i only point to WebPage.class and nothing to do with OracleConn (it is just connection classes).
    Any help, please?
    I also use lots of ways like placing classes12.zip or classes12.jar into many types of folders? Just not sure why cannot?
    I did not use the build in Tomcat for Oracle, but the latest Tomcat 5 series. The servelts works fine but not oracle. Could it be this problem? Like allowing which oracle database to call which web server?
    Thanks.

    It works?
    After i try this and that.
    I just notice 1 thing...
    The database is not connected physically.. even i can sql plus.. it!
    So i go to Oracle Database Admnistrator for Windows NT..
    and connect my servername WenChing..
    and now it works.. servlets can connect to oracle...
    Hooray!
    I hope it stills work when i reboot my machine.. coz i had no idea what i did... :)
    Sounds funny isn't it?
    Regards.
    Chua Wen Ching :p

  • TS3074 Hello anyone with Windows 7, not sure why having followed instructions above, install of latest version of itunes won't work and can no longer open old version either.  anyone help with this?

    Hello anyone with Windows 7, not sure why having followed instructions above, install of latest version of itunes won't work and can no longer open old version either.  anyone help with this?

    Hi,
    thanks for your reply.
    Yes, except n°1 - empty Temp directory, I had tried/checked all of those.
    I emptied the local temp folder tonight, but it still won't work.
    Please note: the installation doesn't give me any problem. The program was working fine, until at one point *plouf* it stopped working. I can re-install it without any problem, it just crashes when opening.
    \\edit\\ I seem to have located the problem, it's in the library files. If I re-install iTunes without my library, it works fine (though there is no music in it, yet). As soon as I import my library, or replace the My Music\iTunes folder with the old one, it stops working.

  • Can't update the flashplayer becasue it states I need to close firefox? Not sure why, I have an updated version of flashplayer but when I go in through firefox it tells me I need to update it, but won't because I am in firefox.

    Can't update the flashplayer becasue it states I need to close firefox? Not sure why, I have an updated version of flashplayer but when I go in through firefox it tells me I need to update it, but won't because I am in firefox. This seems to be a problem when I am in FB.

    You must close Firefox to install the update after it is saved to your hard drive. Follow the instructions below.
    There are 2 versions of Adobe Flash. Both must be installed and updated on Windows systems. In Firefox it would show as Shockwave Flash in your plug-ins, if you had it installed.
    *an ActiveX version for IE only
    *a plug-in version for Firefox and most other browsers
    #'''Install or Update the [[Managing the Flash plugin|Flash]] plugin''' to the latest version.
    #*Download and SAVE to your Desktop so you can find the installer later
    #*If you do not have the current version, click on the "Player Download Center" link on the "'''Download and information'''" or "'''Download Manual installers'''" below
    #*After download is complete, exit Firefox
    #*Click on the installer you just downloaded and install
    #**Windows 7 and Vista: may need to right-click the installer and choose "Run as Administrator"
    #*Start Firefox and check your version again or test the installation by going back to the download link below
    #*'''Download and information''': http://www.adobe.com/software/flash/about/
    #**Use Firefox to go to the above site to update the Firefox plugin (will also install plugin for most other browsers; except IE)
    #**Use IE to go to the above site to update the IE ActiveX
    #*'''Download Manual installers'''.
    #**http://kb2.adobe.com/cps/191/tn_19166.html#main_ManualInstaller
    #**Note separate links for:
    #***Plugin for Firefox and most other browsers
    #***ActiveX for IE

  • Firefox 3.6 disables protection of both Spyware Blaster and Spybot Search & Destroy , not sure why?

    Firefox 3.6 disables protection status of both Spyware Blaster and Spybot Search & Destroy v1.6.2, not sure why?

    I asked a similar question recently, and was told to uncheck the site preferences box in Clear Recent History. I did that and it partly worked - but it doesn't explain why or how FF should be effecting security measures I'd put in place to protect my PC from spyware and malware.

  • Not sure why line break is not working

    Hi all,
    Here is part of my simple Swing application:
    String text1 = "hello";
    String text2 = "world";
    String text3 = text1+"\n"+text2;
    // have also tried (String text3 = text1+"\n\r"+text2;)
    displayField.setText(text3);I supposed that the text3 in the label field (displayField) would display like this:
    hello
    world
    But not, the text3 just displayed in the same line like this instead: helloworld.
    I am not sure why the line break is not working.

    Use HTML for a multiline JLabel.// String text3 = text1+"\n"+text2;
    String text3 = "<html>" + text1 + "<br/>" + text2 + "</html>";db

  • Not sure why Message is not working on my ipad.

    Not sure why message is not work on my iPad. It works find on my iPhone.

    http://support.apple.com/kb/TS2755

Maybe you are looking for

  • HP Deskjet 970cxi two sided printing

    I've got an HP Deskjet 970cxi printer connected to a print server on my LAN. I'm able to print to it from Leopard with no problems. Just works with the Leopard "HP Deskjet 970C - Gutenprint v5.1.3 drivers". However, I can't figure out how to enable t

  • Billing payment trouble

    I've been many times try to change my credit card for payment since i dont use the old one anymore. but it keeps failed with error Id 12000. Someone can help me? I want to purchase themes so bad. Thanks

  • Recompilation of java class invalidates taglib jsp page?

    Hi everyone,           I have a JSP page which calls a custom tag library. On freshly compiling           everything and           calling the JSP page from a browser for the first time the output is as           expected.           However when ever

  • Call template editor

    Hi all! I have been using NI Template Editor for a long time. It is a very very useful program, and it can be called form VA / VBA. Thats the reason why it is so useful. I would like to know how should I use this function/program from my own code. (

  • Saving photos in OS6

    In iPad iOS6, when I try to save a picture I am viewing, the "Save Photo" button appears, but the photo does not save to my Photos app, nor does it upload to Dropbox. I have confirmed the Dropbox is turned on in Privacy settings.