Management concept the exceptions that went wrong!

Well, this is by far the most embarrassing hack code I've done so far... but it works. I'm trying to run a select where if there is no data or null returned, place it in the value "v_pidm"and then let the action happen.» Pretty simple, right? Fake! A select statement returns no data that uses a function 'en' is an exception... "no data found". Oracle, it sends to the exception block as it should. Well, I don't want to stop and start my script a million times here, I added a Begin/End sub, with an exception to handle the error to say and perform an insert. I know that you should not use a State of exception for inserts another capture errors... you know bad practices and all. Any ideas as how to better manage the select statement that must regularly return no data? I was thinking some along the line of nvl (v_pidm, 0) or something, but I get errors.
set serveroutput ON SIZE 1000000
set heading off                
set feedback off                
set trimspool off               
set echo off                    
set pagesize 0  
set termout on


Declare
error     varchar(255); 
v_pidm    number(8); 

 Begin
    Begin    
        select distinct saraatt_pidm  

        into

        v_pidm

        from saraatt, saradap
        where saraatt_appl_no = SARADAP_APPL_NO
        and saraatt_term_code = SARADAP_TERM_CODE_ENTRY
        and saraatt_pidm = 4;
        
      Exception
         when too_many_rows then
        error := SQLERRM;        
        DBMS_OUTPUT.PUT_LINE(' %% Oracle Error! %% The select statement returned more than two rows ');
           
        when no_data_found then
        error := SQLERRM;        
        DBMS_OUTPUT.PUT_LINE('Select Returned No Data . . . Therefore Insert new record for ' || v_pidm );
        
        v_pidm := -999;

        when others then
        error := SQLERRM;        
        DBMS_OUTPUT.PUT_LINE(' %% Oracle Error! %% An Error Occured ' || substr(error,5,20));    
    End;
    
    
    
 DBMS_OUTPUT.PUT_LINE('Pidm: ' || v_pidm);

 End;

There is nothing inherently wrong with code like

BEGIN
  SELECT column_name
    INTO l_variable_name
    FROM table_name
   WHERE some_where_clause;
EXCEPTION
  WHEN no_data_found
  THEN
    l_variable_name := 0;
END;

It is perfectly reasonable to have exception handlers that make anything other than newspaper an exception if they can in fact wisely handle the exception (e.g., you know that the query may return 0 rows and you know how to handle this case correctly).

You don't want an exception handler that simply calls to DBMS_OUTPUT. Put_line without re-raise the exception. It is a mistake to delay. And there is no real reason in this case to extract the SQLERRM in the variable error - it would be better to let the exception is propagated to the top so that you can see the full error stack.

Justin

Tags: Database

Similar Questions

  • The update that went wrong?

    After updating Photoshop cc, I have more lenscorrection or lensblur?  Other funktions/filters have disappeared to?

    WHY?

    After all, I pay every month, so I think its fair if the program works as expected.

    Any ideas, anyone?

    Hi Frank,.

    Please make sure your image is in RGB color space 8 or 16-bit (no not 32-bit). You can see in Image > Mode >

    For example, a 32-bit image will be blurry lens and lens correction is gray, and the blue chip Gallery of filters and many others.

    Mike

  • Has anyone invented a way to get the emails that went to the wrong email address until the wrong person reads?

    Has anyone invented a way to get the emails that went to the wrong email address until the wrong person reads?

    To answer your question, you have to assume that once you have sent the email that it cannot be recovered. Think of it as dropping an old letter in a message box - you can't get it back once it is in the message box.

    The reasons are not only technological - it security, privacy, legal and political might be too (e-mail can cross multiple international borders).

    One hand practice also, what you want would be difficult because the emails will usually quickly reach their destination server and so can be collected by the recipient of email from this server as soon as sound here.

    By ensuring that you are writing your emails correctly in first place is the best.

  • The error "something went wrong initialization library of creative cloud" in all office applications

    The error "something went wrong initialization library of creative cloud" in all office applications. I must have deleted the file CCLibrary 3 times and nothing.

    So I reached out using Adobe. Transferred 4 times, I'm done with that, nobody knew what to do. It is clearly a problem with the communication of the CC with the apps, and no one can figure out who can help, or what is responsible.

    It is a big reason why I do not have a subscription service, when something is wrong (and I needed this functionality), this is what is happening.

    It's terrible. More than two hours of my day for it. No thanks. I'll send my complaints to the top and be more public about Adobe helpdesk.

    Sheena,

    Suggested earlier, and I sent the contents of the current hosts at this time file here:

    ##

    # Database host

    #

    localhost # is used to configure the loopback interface

    # When the system boots.  Do not change this entry.

    ##

    127.0.0.1 obdev.at

    255.255.255.255 broadcasthost

    : 1 localhost

    FE80::1% lo0 localhost

    I had no idea what to change, and no suggestion was really given what to change.

    In any case, I also had the CC on my laptop, so I checked a few apps here, and the library worked well. So, I copied the contents of laptops to my main computer host file:

    ##

    # Database host

    #

    localhost # is used to configure the loopback interface

    # When the system boots.  Do not change this entry.

    ##

    127.0.0.1 localhost

    255.255.255.255 broadcasthost

    : 1 localhost

    .. .and now it works.

    Yes, thanks for pointing me to it, I was able to fix mine.

    Tom

  • Do WLST exception like ' target the exception that is thrown when the application deployment: no such file or directory found in the location of the specified application: "all administration server application deployment

    Hi all

    I'm trying to deploy an application to the administrator of the server using WLST and I had followed steps below.

    (1) I ran setDomainEnv.cmd

    It was performed without error.

    (2) connect to the Server Admin

    Connect ('USERNAME', 'PASSWORD', ' t3: / / localhost:7001', adminServerName = "AdminServer")

    (3) to deploy the application

    deploy ('benefits', 'C:\Users\suhas\Desktop\benefits.war' target = 'AdminServer')

    Traceback (innermost last):

    Folder "system <>", line 1, in?

    File '< iostream >", line 246, to deploy

    File "< iostream >", line of 1848, in raiseWLSTException

    WLSTException: Error occurred when executing deploy: target the exception that is thrown when the application deployment: no such file or directory found in the location of the specified application: C:\Users\suhas\Desktoenefits.war : no such file or directory found in the location of the specified application: C:\Users\suhas\Desktoenefits.war

    DumpStack() to view the full stacktrace

    WLS: serverConfig/test_domain / >

    I'm the exception above, I gave the exact war file path while the deploy command of race but represented except the application path refers to a path that does not exist.

    I, e. instead of display C:\Users\suhas\Desktop\benefits.war C:\Users\suhas\Desktoenefits.war appear

    Please help me solve this problem.

    Thank you and best regards,

    Suhas

    You can use the script here

    Automation of the deployment of the application on Oracle Weblogic Server

    Use a backslash instead of the forward slash... and type it instead of copy paste...

  • Update graphics card that went wrong; Need help.

    Let me first, I the a6700f desktop model.

    Here's my problem... There is a month that I bought a graphics card for my computer, the NVIDIA GeForce 8400GS 512 MB DDR2 PCI Express graphics card, link below:

    http://www.BestBuy.com/site/olspage.jsp?skuId=8990407&type=product&ID=1218007083381

    . It was great to work on my computer, and I liked the fact that I can play higher quality video and games on my computer, which could barely handle with the 6150 it comes with. It worked fine for about 2 days, when my friend told me that he had the 8600 model given to him by his cousin, but because it was a PCI Express model, it has failed on its motherboard. So he let me try, because it was the card I have established originally to get (but the Best Buy had not).

    I pulled the 8400 which worked very well and replaced it with the 8600. When I turned on the computer later, the monitor never displays anything. I could hear the music start and everything, so I know that it was running; However, the monitor shows nothing. So I turned off has released the 8600 and then tried the 8400. Even if it was working fine before trying the 8600, the monitor wouldn't read something with her. I thought it would be the monitor that was just straight up, so I tried another. The same problem. I then looked online and saw some article talks about food that may be too low because the amount required for the 8600 was 300w, exactly what my computer. So, I went to Best Buy and bought a 450w power supply and tried with that. Still did not work. I thought it could be the graphics card, so I returned it and got the same exact model, just a new. Still did not work. I even reformatted my entire computer to the settings it had when I bought it, and nothing has worked. I tried to clean my computer, searching for scratches and haven't found anything.

    The only way that the monitor has worked has been without any graphics in it (just the 6150) he built). I've been turned off to repair, because I know in general how to solve small problems like that, even if I can't know all the technical terms for computers (I'm more a guy who recognizes the parts and what they do).

    If someone knows a solution that I have not yet tried, please let me know about it so I can give it a shot and no waste of money do repaired and it have to be a simple solution.

    ----

    Additional information:

    I bought this computer some time in February this year, so it is still fairly new. However, I don't have the receipt so that it doesn't matter where, so I don't think I'm able to do anything with the warranty on it. I have also heard people that they do not cover damage of upgrades (don't know if it of true or not). Is there a way I can still make them fix it, or just get it replaced?

    Message edited by Luckybucket on 01/06/2009 19:42

    The pci-e slot is damaged and I suspect that this has been done when you were installing the 8600. It is not too difficult for the location on the motherboard with static damage physically or a force applied the wrong angle. HP will simply not provide a warranty if you have haveis a computer that cannot be used with the integrated graphics card or maybe (shudder) a simple pci card video.

  • Mail 'Classic' split screen that went wrong

    How to restore "classic" split screen mail? I accidentally dragged the divisor completely to the bottom of the screen that it, and now I can't move it to the top.

    Here are a few suggestions (the last of them is maybe you need):

    Show/Hide Preview mail pane

  • laptop battery that went wrong?

    I have a laptop Pavilion dv7. It is 18 months old and the (640 GB) HDD crashed. I tokk it to local repair shop and they succeeded him and was told that it was the battery that caused his failure. The battery worked fine for me, but I never noticed anything unusual. My question is the battery maybe the cause of this malfunctio or did just sold me a battery in addition to the hard drive.

    This means that all resolve itself?

  • Windows7 upgrade that went wrong

    Hello

    My son got a machine running vista and it has upgraded to Windows7 with a free upgrade, which he received at the University that he attended.  It was received at the campus bookstore, so it should have been a legal copy.  We now have this machine at home and he says that the software is not authentic (lower right corner of the screen).  I had a few problems with trying to download updates, etc, and I need to fix this problem.  I see two options:

    1 somehow get this valid therefore it works like authentic software.  How can I do this?  I tried to do it online already, but it's Microsoft want to sell me a copy of Windows7.  I don't want to spend more money on this machine, so I'm not interested.  But assuming that my son has received a valid copy of Windows7 to its campus bookstore, I should be able to make it work somehow.  Any ideas?

    2 go back to Vista.  I think that the copy of Vista system restore is still on this machine.  How can I access that and put the system back to how it was before the update Windows7 was made?

    Thank you very much!!!

    How to activate Windows 7 or Vista manually (activate by phone)
    1) click Start and in the search for box type: slui.exe 4
    (2) press the ENTER"" key.
    (3) select your "country" in the list.
    (4) choose the option "activate phone".
    (5) stay on the phone and waiting for someone to help you with activation.

    Also:
    Windows Activation video
    http://www.Microsoft.com/showcase/en/us/details/c09aefc0-1986-4C2F-Bad4-67487854f13f
    This video will show you: - how to enable Windows - where to find your product key
    How to use your product key - how to get support for the product activation

    How to activate Windows 7 by phone
    http://support.Microsoft.com/default.aspx/KB/950929/en=us
    http://www.SevenForums.com/tutorials/18715-activate-Windows-7-phone.html

    How to activate Windows Vista by phone
    http://support.Microsoft.com/kb/940315
    http://www.mydigitallife.info/2008/10/13/how-to-activate-Windows-Vista-by-phone-activation/

    Microsoft Activation centers worldwide telephone numbers:
    http://www.Microsoft.com/licensing/existing-customers/activation-centers.aspx
    (This site is for activating Volume License, but if you call, they will help you)

    The phone number is not working:
    Microsoft Wordwide contacts: http://www.microsoft.com/worldwide/default.aspx

    Product Activation Solution Center
    http://support.Microsoft.com/contactus/cu_sc_prodact_master

    Windows 7 activation error: invalid product key
    http://Windows.Microsoft.com/en-us/Windows7/Windows-7-activation-error-invalid-product-key

    Stuck key (error 0xC004C4A2):
    http://social.Microsoft.com/forums/en-us/genuinewindows7/thread/a2444f34-0AFF-4f29-a8ac-67e28b0c0285

    Windows 7 activation error: 0xC004F061
    http://Windows.Microsoft.com/en-us/Windows7/Windows-7-activation-error-0xC004F061
    "If the error"0xC004F061"when you try to activate Windows 7,
    This means that you are using a product key for a Windows 7 upgrade version and
    a previous version of Windows wasn't on your computer when Windows 7 was installed. »

    How to fix Volume Windows 7 Activation error codes
    Computers Windows Vista and Windows Server 2008.
    Includes a list of the different error of activation codes (for example 0xC004F009) and solutions.
    http://support.Microsoft.com/kb/938450

    Microsoft Genuine Advantage Diagnostic tool:
    http://www.Microsoft.com/genuine/selfhelp/ServiceRequest.aspx
    Download the tool: http://go.microsoft.com/fwlink/?linkid=56062
    Post your results here or in the forum: http://social.microsoft.com/Forums/en-US/genuinewindows7/threads

    --------------------------------------------- Uninstall Windows 7 ------------------------------------------------

    How to uninstall Windows 7:
    http://support.Microsoft.com/default.aspx/KB/971762

    How to restore a Windows 7 computer to a previous Windows installation by using the Windows.old folder:
    http://support.Microsoft.com/kb/971760

    JS
    http://www.PAGESTART.com

    Never be afraid to ask. This forum has some of the best people in the world to help.

  • print job that went wrong!

    If I try to do a print job as follows in a child of the canvas of a view stack:

    adgPrint is an advanced datagird

    var printJob:FlexPrintJob = new FlexPrintJob();
    PrintJob.Start;
    printJob.addObject (adgPrint, FlexPrintJobScaleType.MATCH_WIDTH);
    PrintJob.send();

    If adgPrint is in another painting for the one that is currently visible that I get sheets of paper to the printer that are completely black.

    If

    var printJob:FlexPrintJob = new FlexPrintJob();
    PrintJob.Start;
    printJob.addObject (adgPrint, FlexPrintJobScaleType.MATCH_WIDTH);
    PrintJob.send();

    is called when the canvas in the viewstack (containing the adgPrint) is selected the thing print very well

    strange

    Hello

    Flash prints only the visible data, which is visible to the user. It is an optimization. In the invisible parts viewStack creates only on the first call.

    So if you want to print the invisible part, you need to set it visible, print and printing of end (there is an event for this) restore the whole visible to the old view. It is absolutely invisible for the user, I checked it.

  • Windows 7 update for the week of 06/09/2015 - that went wrong

    After the installation of 17 updates

    10 security

    6 win 7 x 64 and

    1 malware

    The icons of my wallpaper and the Office disappeared.  It has been replaced by a gray screen with 5 icons of base.  I saw a message of information relative to: connect to the files your doc and fav?

    I restored the machine to an earlier date to eliminate all of the updates.

    I don't know what to think except this set of updates have gone bad...

    Are that Win 7 is responsible for updating this, should I remove the updates of the victory and just install the other 11?

    TerO

    Please provide a copy of your system information file. Type the system information in the search box above the Start button and press the ENTER key (alternative is select Start, all programs, accessories, System Tools, system information). Select file, Export and give the file a name noting where it is located. Not to place the cursor in the body of the report before exporting the file. The system creates a new information file system each time system information is available. You must allow a minute or two before the file is completely filled before exporting a copy. Please download the file to your OneDrive, to share with everyone and post a link here. Normal mode preferred report. Please say if the report was obtained in safe mode.

    Please download and share with everybody fresh copies of your System log and journal of the Application (two files) of your event to your OneDrive Viewer and post a link here. You can delete any previous copies of your OneDrive records.

    To access the system, log, select Start, Control Panel, administrative tools, Event Viewer, in the list on the left of the window, expand Windows logs and select System. Place the cursor on the system, select the Action in the Menu and record all events like (the evtx default file type) and give a name to the file. Do the same for the application log. Do not offer not filtered files. Do not place the cursor in the list of reports before selecting the Action from the menu. Do not clear the logs so that you have a persistent problem.

    For assistance OneDrive see paragraph 9.3:
    http://www.gerryscomputertips.co.UK/MicrosoftCommunity1.htm

    General remarks on event viewer
    http://www.gerryscomputertips.co.UK/syserrors5.htm

  • How to fix a system restore that went wrong? Service Pack 2 error?

    Hello

    I tried recently to solve a problem with my monitor and used the system restore to do. It has fixed the problem, until the next day.

    Second day, I decided to try to use the restore of the system again, but this time I went back about a month to restore (just before I installed my video card drivers). I didn't know at the time where you're not supposed to do that (or so I've been told since). I don't have a problem with my monitor, but everything else is broken. I have no sound, no webcam and no USB port - to name a few. The problem is that Windows cannot upgrade to Service Pack 2. I tried using Windows Update and download SP2 from the Web site and manually install, nothing done. Someone has an idea, what happens? I'm not very computer savy, unfortunately. Thanks for any help you can offer.

    https://support.Microsoft.com/OAS/default.aspx?PRID=13014&Gprid=582034&St=1

    Free unlimited installation and compatibility support is available for Windows Vista, but only for Service Pack 2 (SP2). This support for SP2 is valid until February 26, 2010.

    FREE support for your installation of Vista SP2 on the link above of Microsoft problems.

    See you soon. Mick Murphy - Microsoft partner

  • Upgrade of blackBerry Smartphones that went wrong!

    Hello

    I am a new customer of blackberry and a bit of a techno * beep *.

    When I bought the phone, the clerk informed me that the softwear needed to be upgraded. I did it through the blackberry Desktop Manager. I first supported all the info on the phone to my computer.

    However, when the phone has restarted everything was gone. I was able to restore the contacts but had lost blackberry maps and the versions of blackberry of word and excel. I really want to the back. Please could someone tell me how to proceed?

    They do not appear here but when I ask him to add told me that they are corrupt and cannot be added.

  • Hard drive transfer that went wrong.

    I copied all my pictures folders from a disk of 3 TB to 5 TB, but did not use LR. I then imported all the photos of the 5 TB in LR. Of course, all my changes are gone. What can I do? Still, I have the 3 TB and these changes but want to use 5 TB disk, go ahead. Help?

    Remember that Lightroom is designed as a single user, single computer management system.

    If you want to share of ALL changes to a picture, you need to "export catalogue" so that the user can ' import the catalog. Or otherwise share your catalog with him at a time when you are not running Lightroom.

  • Import from a. PSD file that went wrong

    Hello

    In Photoshop, I've added a few new 17 image layers, then I copied (from an existing layer of the image) and glued the layer style in the layers of the newly added image.  Everything went very well in Photoshop.  All images appear correctly with the style to layer correctly in place, which means that the shadows appear correctly.

    In any case, once I import the. The new image in Flash CS4 PSD layers are darker shadows (100% instead of 50/75% opacity)

    Any ideas?

    Kind regards

    Ronald

    Hello

    I suggest you use the classic method... import each as a transparent PNG.

    You will have no problem.

    Trust me.

    RanTen

Maybe you are looking for