Set the error code for the exception qualified using the pragma exception_init

Hello

I did experiments on exception management in oracle plsql. In my experiments, I did the following anonymous plsql block.


+ < < outer_block > > +.
declare
+ exceptions.    +
Start
+ < < inner_block > > +.
+ State +.
+ exceptions.        +
+ start +.
+ recovery outer_block.exc +;
+ exception +.
+ What then outer_block.exc +.
+ dbms_output.put_line ("' outdoor Exception caught"); +
+ What then inner_block.exc +.
+ dbms_output.put_line ("'Inner Exception caught"); +
+ end; +
end;


When I run the code, I got the output "external Exception caught".

------------------------------------------------- PLSQL Block 2 -------------------------------------------

I changed the code a little differently by assigning exceptions error codes.

+ < < outer_block > > +.
declare
+ exception exc; +
+ pragma exception_init (exc,-20001); +
Start
+ < < inner_block > > +.
+ State +.
+ exception exc; +
+ pragma exception_init (exc,-20001); +
+ start +.
+ raise_application_error (-20001, "Error"); +
+ exception +.
+ What then outer_block.exc +.
+ dbms_output.put_line ("' outdoor Exception caught"); +
+ What then inner_block.exc +.
+ dbms_output.put_line ("'Inner Exception caught"); +
+ end; +
end;

When I run the above code, I got the following error.

Error on line 1
ORA-06550: line 15, column 9:
PLS-00484: exceptions redundant "EXC" and "EXC" must appear in the same exception handler
ORA-06550: line 5, column 1:
PL/SQL: Statement ignored

Script done on line 21.

------------------------------------------------- PLSQL Block 3 -------------------------------------------


To avoid this error, I changed the code again by qualifying exceptions with their block names. This time, I got a different error.

+ < < outer_block > > +.
declare
+ exception exc; +
+ pragma exception_init (outer_block.exc,-20001); +
Start
+ < < inner_block > > +.
+ State +.
+ exception exc; +
+ pragma exception_init (inner_block.exc,-20001); +
+ start +.
+ raise_application_error (-20001, "Error"); +
+ exception +.
+ What then outer_block.exc +.
+ dbms_output.put_line ("' outdoor Exception caught"); +
+ What then inner_block.exc +.
+ dbms_output.put_line ("'Inner Exception caught"); +
+ end; +
end;


Error on line 1
ORA-06550: line 4, column 38:
PLS-00103: encountered the symbol ". «» When expecting one of the following values:

), = >
The symbol"were replaced by". "to continue.
ORA-06550: line 9, column 42:
PLS-00103: encountered the symbol ". «» When expecting one of the following values:

), = >
The symbol"were replaced by". "to continue.



Question:
Pourraient several exceptions with the same name of the exception defined in the set of nested blocks plsql assign error codes using the pragma EXCEPTION_INIT? If there are errors in the PLSQL 2 blocks and 3, please suggest.
If the same thing could be accomplished by other methods, please explain.

The problem in your code block 2 is that you have not only used the same name of the exception, but you have assigned them with the same exception code. If the code is different so it will work...

SQL> set serverout on
SQL> ed
Wrote file afiedt.buf

  1  <>
  2  declare
  3      exc exception;
  4      pragma exception_init(exc,-20001);
  5  begin
  6      <>
  7      declare
  8          exc exception;
  9          pragma exception_init(exc,-20002);
 10      begin
 11          raise_application_error(-20002,'Error raised');
 12      exception
 13          when outer_block.exc then
 14              dbms_output.put_line('outer Exception caught ' );
 15          when inner_block.exc then
 16              dbms_output.put_line('Inner Exception caught ' );
 17      end;
 18* end;
SQL> /
Inner Exception caught

PL/SQL procedure successfully completed.

SQL> ed
Wrote file afiedt.buf

  1  <>
  2  declare
  3      exc exception;
  4      pragma exception_init(exc,-20001);
  5  begin
  6      <>
  7      declare
  8          exc exception;
  9          pragma exception_init(exc,-20002);
 10      begin
 11          raise_application_error(-20001,'Error raised');
 12      exception
 13          when outer_block.exc then
 14              dbms_output.put_line('outer Exception caught ' );
 15          when inner_block.exc then
 16              dbms_output.put_line('Inner Exception caught ' );
 17      end;
 18* end;
SQL> /
outer Exception caught

PL/SQL procedure successfully completed.

Tags: Database

Similar Questions

  • When the updates of windows I get and error code for 643. How can I fix it?

    When the updates of windows I get and error code for 643. How can I fix it?

    When the updates of windows I get and error code for 643. How can I fix it?

    Here is an answer which is marked as an answer to the error code 643.

    I also participated in that thread, and I gave my suggestions.

    http://answers.Microsoft.com/en-us/Windows/Forum/windows_vista-windows_update/what-is-error-code-643-Windows-vistaunable-to/4ab6dd4e-e9eb-4a0f-b822-ad976e2c33c6

  • Ideas: I get the 0x80073AFC error code when I try to use the system restore then, how can I find and replace this file missing MUI?

    Remember - this is a public forum so never post private information such as numbers of mail or telephone!

    Ideas: I get the 0x80073AFC error code when I try to use the system restore then, how can I find and replace this file missing MUI?

    • I am running Windows 7 for packs SP 1 or SP 2 does NOT solve my problem since neither one works with Windows 7.  Is there a way to search for this MUI (Multiple User Interface) missing file? The every thing must have himself installed in the first place. I took my mom (she died in June) and my brother on this PC as users so even if they do not use this PC supports multiple users. Maybe if I deleted as a reboot and additional users it will solve my problems. My updates install OK but I can't run at all system restore. It creates a restoration point OK but when I try to sr back to a restore point before I get the error 0x80073AFC topic of the missing MUI file. Then, when I spear SR it is said that he could not and no files have been changed because of the error 0x8000FFFF error, unspecified catastrophic failure and could not retrieve the file several times when system restore is attempted.

      I'm running Windows 7 on a HP Pavilion with browser Firefox 3.6.8 browser Opera 10.60, IE8 and Google Chrome 5.0.375.125 browser browser.

      Can you tell me what I try next? Thnks a lot and sayonara for now the guy-Jack McElwee / keimanzero the Scion of the Anime in Brookhaven PA - USA

      OK I tried everything and nothing works! Only added beginners are updated browser Opera 10.63; IE9 (Beta); Firefox 3.6.12 and Google Chrome 7.0.517.41 and Java 22. Of course like everyone else in the world, I had to uninstall/enable and disable/download again and reinstall new Adobe Flash 10 and 11 of the shock wave and they keep crashing too! Hello 4 keep screwing browsers and now I get connection network problems. I run Comcast doctor and did everything it said to do, but nothing works. Oh and I added 7-Zip and WinZip also. Likewise, they will not work! Help! Thanks - K & K

    keimanzero,

    Comcast of Norton Security Suite version is installed? If Yes, who and perhaps malware is most likely to cause questions you have published, in particular the failure of the restoration of the system.
    First, configure the system to boot - How to solve a problem by performing a boot in Windows Vista or in Windows 7
    NOTE: Start-up mode minimum state all the 3rd party firewalls will be disabled. Open Control Panel > Windows Firewall to make sure that the native firewall of Windows 7 is now on.

    Download and Save the update system (or CheckSUR) tool. You will need to download the specific Version of CheckSUR corresponding to the architecture of the system to Windows 7. If you do not know the architecture of the system, and then click the link that says "Click here to show or hide the instructions step by step with images" under method 2: download the update directly system preparation tool from Microsoft Download Center .
    Description of the preparation tool system update for Windows Vista for Windows Server 2008, for Windows 7 and for Windows Server 2008 R2

    Once the download is complete, close all open programs and browsers. Now, run CheckSUR with the system connected to the internet because it will download the .cab for system files. Reboot once CheckSUR is complete.

    Secondly, I suggest that you run the File Checker system while in the same clean boot state.
    To run the System File Checker tool, follow these steps:

    1. Click Start and type cmd in the field search programs and files .
    2. Right click on cmd.exe in the programs of list, and then choose 'run as administrator '.
      If you are prompted for an administrator password or a confirmation, type your password or click on continue.
    3. At the command prompt, enter the following line exactly as written including the space between thec and the/and then press ENTER:
      sfc/scannow

    When the analysis is complete, test to see if the problems facing the system have been resolved.

    If they are not, you will need to contact Norton support for the version of Norton Internet Security Comcast to get help, or just uninstall NIS, run the Norton removal tool (right click Norton_Removal_Tool.exe, choose "Run as Administrator"), reboot and then check to see if the problems are still occurring.

    Expert MowGreen Windows IT Pro - consumer safety

  • Error code: 6004; MODBUS Exception code: 4

    Hello

    What means this error: error code: 6004; MODBUS Exception code: 4

    Thank you

    Hi Peter,.

    Here is the description of the error:

    error

    concerning

  • Error code for media player C00D10CD

    Error code for media player C00D10CD

    Hello

    Refer to this article, it helped me.

    http://msgroups.NET/Microsoft.public.windowsmedia.player/problem-to-play-VCD-or-d/116738

    All the best

  • Update Windows to KB951847, KB2656369, KB2656370, error code for each where 0x8007064c, 0 x 645, 0x64c. Net framework problems

    I have a win xp machine and tried to do a windows update KB951847, KB2656369, KB2656370, the end of all errors.

    When I check history update, error code for each where 0x8007064c, 0 x 645, 0x64c.

    I followed an article in the knowledge base on the code of erro 0x6007064c, subject to rename the download of C:\WINDOWS\SoftwareDistribution directory.

    Tried to reinstall, same problem,.

    has ran Mr fixit, same problem, he ran Micorsoft difficulty focus the same problem.

    How can I get the Microsoft Update to work properly?

    Any help is appreciated.

    See http://support.microsoft.com/kb/958055

    See also http://support.microsoft.com/kb/976982 (ignore the title & the Symptoms section)

    PS: KB951847 is an option, non-security update - feel free to hide it.

  • I get a 0x80070424c error Code when I try to use the recommended settings for my Windows Firewall

    My PC suddenly stopped sharing music to my Xbox over the 3 days.

    My firewall is weird and it is said that "the Windows Firewall does not use recommended settings to help protect your computer.

    When I click to use the recommended settings, I get an 0x80070424c error Code. I tried following the steps here: http://support.microsoft.com/kb/968002 and it did not work

    Hello

    If you are having problems turning on Windows Firewall, follow these instructions:
    Download and install Windows Repair: '
    When repairing Windows opens, click the tab for Startup Repairs click Start. Clear all check boxes except for the following four:
    -Reset the registry permissions
    -Reset the permissions of files
    -WMI repair
    -Repair Windows Firewall
    Then click Start. Once it is finished, restart your computer.
    I hope this helps you.
    Brian
  • Suddenly can't send/receive email through Windows Live Mail (see the below error code). I tried to use gotoassist.me for the online help, but could not connect as if something is blocking that, too.

    Your server suddenly put an end to the connection. The possible causes for this include server problems, network problems, or a long period of inactivity.

    Subject 'test '.
    Server: 'smtp.gmail.com. '
    Windows Live Mail error ID: 0x800CCC0F
    Protocol: SMTP
    Port: 465
    Secure (SSL): Yes

    You may have the wrong SMTP port.  Check the appropriate injector.

    You may also have another step which is not described anywhere I could find:

  • I have the 43 error code for my iPod touch

    Whenever I am trying to connect my iPod to connect to iTunes (which by the way, is updated to the most recent), windows indicates that the device is defective or omitted of to connect/install.
    So when I troubleshoot it, the error code 43 appears. Everything he says is ""unknown device.""

    Any help?

    Hi Ethan_kim,

    I understand that you get an error code 43 for your iPod touch. I understand the inconvenience.

    A Code 43 error when Device Manager to stop a hardware device, because the material reported to Windows that is having some sort of problem not specified.

    This very generic message could mean a hardware problem real or it may simply mean that there is a driver problem that Windows is not seen as such, but that the material is affected by.

    I suggest you to contact the Apple Support to get help in this issue.

    -IPod support
    http://www.Apple.com/support/iPod/

    iTunes and iPod Support
    http://www.Apple.com/support/

    It will be useful. For any other corresponding Windows help, do not hesitate to contact us and we will be happy to help you.

  • Where can I get a list of the error codes for InDesign server

    I use InDesign server to the process that a lot of jobs and could not find a list of error codes generated by InDesign Server. Specifically, I'm looking for error codes generated in cases where the InDesign customer seem to have made a mistake. To give an analogy, the Apache HTTP Server generates class 4xx Code of the status each time the client seems to have erred. Is there a list of error codes similar for InDesign server.

    For example:, I wrote a work to convert .indd idml files and voluntarily gave a corrupt .indd file to convert. I got the following response code.

    Error code: 29441

    Error message: could not open the file "corrupt_file.indd". Adobe InDesign Server can not supported file format, a plug-in that supports the file format is may be missing, or the file may be open in another application.

    I couldn't find a reference to the error code 29441 in the Adobe documentation. All leads or references?

    Thank you

    Michel

    You can download here CS6 server error codes:

    Dropbox - errorcodes.htm

  • I do not receive an error code for updates failed

    original title: update seems to work and indicates successful but when I check some updated why some say failure and why does not receive an error code during the update process?

    Whenever I update the installation process says successful but when I went on a lot of my updates to display the details I see "failed." Why is not updating error messages instead of download the update and declaring that it was installed successfully? Why this is happening, seems I can't besure if my updates are actually loaded, even if each notes "installed successfully". I don't want to have to go thro each update to check its status.

    Hello

    By default, the Windows Update client records all transaction information in the following log file:

    %WINDIR%\WindowsUpdate.log

    If you receive an error message on the Microsoft Windows Update Web site or automatic
    Service updates, you can use the information in the Windowsupdate.log file to resolve the problem.

    Open the log file and search for the error codes. Post the logs here so that we can check what exactly is causing the problem.

    Refer to this article for help:
    http://support.Microsoft.com/kb/902093

    Kind regards
    Afzal Taher
    Microsoft technical support engineer

  • I get this error code for micrsoft defender and it cannot open 0x800106ba

    Cannot have open after that I get a message that it's off. I'll go through the steps to change the setting to on, but this error code appears.

    What other security programs you have running? MSE, AVG, Norton, and McAfee will stop Windows Defender because they have the same functionality and WD becomes superfluous. It's normal.

  • I have two error codes for windows live mail 0x800cccD & 0x800ccc0E

    When I try to send an email I get this error message Impossible to receive then two error codes are displayed.

    Hello Reddog3333,

    Thanks for posting in the Microsoft Answers forum! I would recommend that you post in the Windows Live forum below to support more specialized with your question:

    http://windowslivehelp.com/

    Please let me know if this helps J

    Adam
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think

  • Error code for Reader 8 x 80070052 thumb

    Backup files on a 1 GB USB key, I started having an error code 8 x 80070052 and don't load no more files, but the USB is only half full. Anyone had this happen? No idea what means this error code?

    Hello

    You may need to format the USB key if the method in the lower section
    does not help. And it is possible, that there is a problem with the hardware with the reader.

    How to format the USB drive and memory with NTFS
    http://www.online-tech-tips.com/computer-tips/format-USB-NTFS/

    Format a Flash DRIVE with the NTFS file system
    http://www.pctipsbox.com/format-a-USB-drive-with-NTFS-file-system/

    ===========================

    This is the likely cause of your error:

    A USB can support only a very limited number of files and folders at the root
    Directory/folder. To resolve this are one or more folders and copy the files into it/them.

    H:\ if H: is the thumbdrive

    H:\Myfiles

    H:\Documents

    and so one and copy the files in these folders. You may need to remove a few files in a
    apparently a lot thumbdrive to create the folders.

    I hope this helps.

    Rob Brown - Microsoft MVP<- profile="" -="" windows="" expert="" -="" consumer="" :="" bicycle=""><- mark="" twain="" said="" it="">

  • Error code for windows vista

    I download my anti virus yesterday and my computer asked me to restart it when it was done, so I started it and now I can't even my computer computer continues to tell me that I need to enter my product key, then when I try to do it tells me its wrong and I get the error code : 0xc004f050. I don't know what to do and really need to use my computer as soon as possible.

    Run slui.exe in the run box (WIN + r) "a programmer is just a tool that converts the caffeine in code" Deputy CLIP - http://www.winvistaside.de/

Maybe you are looking for

  • PROTECTED Z10t starts key USB NI USB CD-ROM

    Hellofor some reason, I have to boot from a USB key memeory containing WinPE and Linux (depending on the task to perfom). My problem is I got blocked on the logo "Toshiba leading innovation" and nothing else happens.As soon as I remove the USB key, i

  • String to timestamp with milliseconds

    Hi, the image below show me convert the time in a timestamp (and its replacement by a timestamp date different. It works great except for the milliseconds. You can see here the milliseconds are defined as "% 2d" and it does not work. If I replace by

  • Droid bionic music

    Audio random are to be duplicated and I don't know why. some songs are duplicated 2 or 3 times, but some do 5 or 6 times. very very strange. I'm not sync-ing or via vcast, connect only usb load mode and endearing when it is connected to my pc. any he

  • Stop sign-in password?

    Can I get rid of the sign-in password? I want 1 - click sign on so I don't have to put a long password. I work at home and the login password screen comes on when I'm in the middle of work.

  • I get an A12E6 error when I try to download lightroom. How can I fix it?

    I am trying to download Lightroom 6 and I get an A12E6 error when I try to download lightroom. How can I fix it?