How to manage the plsql error occurring in the exception block

We know how to manage exceptins located in the BEGIN block.
But I am unable to catch the exception in the exception block. Write an erroeneous code so that the control will go to the exception block and there is also a plsql error, but I am unable to handle that error, it returns the error to the calling environment.

DECLARE
CNT NUMBER (5): = 0;

BEGIN

Select "Chris" IN double's NTC;
DBMS_OUTPUT. Put_line (to_char (CNT));

EXCEPTION
WHEN invalid_number CAN
DBMS_OUTPUT. Put_line (' error occurred inside the start block ');

CNT: = "deba";

WHILE OTHERS THEN
DBMS_OUTPUT. Put_line (' error occurred inside the start block ');

END;

Please suggest me how to catch this exception?

Hello

DECLARE
CNT NUMBER (5): = 0;

BEGIN

Select "Chris" IN double's NTC;
DBMS_OUTPUT. Put_line (to_char (CNT));

EXCEPTION
WHEN invalid_number CAN
DBMS_OUTPUT. Put_line (' error occurred inside the start block ');

CNT: = "deba";

WHILE OTHERS THEN
DBMS_OUTPUT. Put_line (' error occurred inside the start block ');

END;

First of all your exception mouhamadou who you have sent i.e. invalid_number itself does not.
You should use named exception VALUE_ERROR to catch the exception in the main block.

SQL> DECLARE
  2  cnt NUMBER(5):=0;
  3  BEGIN
  4  select 'debalina' INTO cnt from dual;
  5  DBMS_OUTPUT.PUT_LINE(to_char(cnt));
  6  EXCEPTION
  7  WHEN Invalid_number THEN
  8  DBMS_OUTPUT.PUT_LINE('error has occured inside main block');
  9  end;
 10  /
DECLARE
*
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: character to number conversion error
ORA-06512: at line 4

SQL>  DECLARE
  2   cnt NUMBER(5):=0;
  3  BEGIN
  4  select 'debalina' INTO cnt from dual;
  5  DBMS_OUTPUT.PUT_LINE(to_char(cnt));
  6  EXCEPTION
  7  WHEN VALUE_ERROR THEN
  8  DBMS_OUTPUT.PUT_LINE('error has occured inside main block');
  9  end;
 10  /
error has occured inside main block

PL/SQL procedure successfully completed.

Your doubts regarding catch the exception in the exception block, you can run as below, by nesting a block Begin in the exception block itself.

SQL> DECLARE
  2  cnt NUMBER(35):=0;
  3  BEGIN
  4  select 'debalina' INTO cnt from dual;
  5  DBMS_OUTPUT.PUT_LINE(to_char(cnt));
  6  EXCEPTION
  7  WHEN Value_error THEN
  8  DBMS_OUTPUT.PUT_LINE('error has occured inside main block');
  9  Begin
 10  cnt:='deba';
 11  Exception
 12  WHEN OTHERS THEN
 13  DBMS_OUTPUT.PUT_LINE('error has occured inside exception block');
 14  End;
 15  END;
 16  /
error has occured inside main block
error has occured inside exception block

PL/SQL procedure successfully completed.

Hope your question is clear.
:)
Twinkle

Tags: Database

Similar Questions

  • I would like to know how to manage the ASN.1 encoding/decoding in LabView?

    I would like to know how to manage the ASN.1 encoding/decoding in LabView?

    Hello J,

    in the example given here , it looks like a format simple bytestream...

    You must read the byte stream, get the first and the second byte to decode the data type and length and then read & catalogued according to number of bytes. And then read 2 bytes and so on...

    Encoding will work the same but in reverse

  • How to manage the tv after hdmi to hdmi connection

    I want to connect to my computer windows 7 with tv on my Vizio tv hd tuner. I intend to use the hdmi to hdmi connections. After that I made the connection how to manage the tv without going back to the computer. My TV is in another adjacent room to my computer, sbout 20 ft away. Can I use a wireless mouse to manage the tv? The monitor and tv both appear at the same time? What are other options? Thank you for taking my question and to meet others, I put in the forum. Donnie

    I guess that the xbox 360 is a must for my setup. Thanks for your reply, Donnie

  • How to manage the SOAP response

    Hello (beginner vCO),

    I use the SOAP Plugin and trying to figure out how to manage the here, a host of SOAP response is the log I get the SOAP response

    [12:53:43.124 2014-05-09] [I] the settings...

    [12:53:43.135 2014-05-09] [I] the available settings:

    [12:53:43.136 2014-05-09] [I] + parameter name: "GetRequestStatusResult", value: "< response >

    < item >

    < ServiceRequestID > SR138917 < / ServiceRequestID >

    OS DEPLOYMENT < ServiceRequestStatus > < / ServiceRequestStatus >

    < ServiceRequestCreated > 09/05/2014-15:20:25 < / ServiceRequestCreated >

    < ServiceRequestCompleted > < / ServiceRequestCompleted >

    MA138921 < CurrentActivity > < / CurrentActivity >

    OS DEPLOYMENT < CurrentActivityTitle > < / CurrentActivityTitle >

    < ActivityStartUTC > 09/05/2014-15:32 < / ActivityStartUTC >

    < ActivityEndUTC > < / ActivityEndUTC >

    < DurationTotalSeconds > < / DurationTotalSeconds >

    < AverageDurationSeconds > < / AverageDurationSeconds >

    < SecondsOffAverage > < / SecondsOffAverage >

    < EstimatedCompletionUTC > < / EstimatedCompletionUTC >

    < / OutputParameters >

    < warning > < / warnings >

    < exceptions > < / Exceptions >

    < / response > '

    It will be better to try and parse text or try and use another method with vCO

    If you haven't done so already, take a look at the action of com.vmware.libarary.soap.processOutParameters.  It is the action that generated the log you have placed in us.  It generates an object Properties (key, value pairs) with the value for each setting that results.

    In your case, assuming that 'outProps' is the result of the above, you can use:

    var getRequestStatusResult = outProps.get ("GetRequestStatusResult");

    And to analyze the code XML with E4X as Ilian said.

  • How to manage the photos Lightroom when using 2 computers, keeping any changes made on one or the other?

    Based on http://forums.Adobe.com/thread/1308132?TSTART=0 I decided to add each question separately:

    Hello, I am very interested in buying Lightroom 5.2. I tried the RC that was missing today. Yet, I have several questions that I can't find really good conclusive answers, I'd like to get an answer before buying LR. Please do not write maybe like this or that (assumptions), because I don't want to start my entire workflow and then realize that I have to change all around, please reply, if you know for sure that something works and you are, preferably, using this method too.

    Is the big question, where I want to especially a conclusive answer:  How to manage the photos Lightroom when using 2 computers, keeping all the changes made on one of them, using the same photos for editing. I'm not going to use DNG. Details: I mainly use my old MacBook Pro, but I wish I could use my PC as it is much better (card: i5 2500K, 16 GB of RAM, SSD, USB3, nVidia GTX 560 TI etc.). I have 2 external HD that I could use, one for backup and one for the actual Photos/changes. I you will probably need to use as my internal HDs are fairly complete and I cannot be the kind of things simply delete or move to one (developer, without loss of music, programs etc.).

    On this basis, how do I save all such Photos folder (pictures and retouching and preferably presets too)?

    According to me, that it should be possible to work cross-platform without having to create a link to the files each time, or without having to keep export/import of the catalog, keeping the single catalog and the picture library on an external drive that is then switched between systems as needed.

    Obvious first requirement is an external drive that is formatted in a way (for example, FAT32) that it can be used on both platforms in read/write mode. Given that, if the catalogue AND folder parent si le catalogue ET le dossier parent images are both set to the same level in a global parent folder, then it should be possible to take advatage of ability of Lightroom to use relative paths instead of absolute paths to detect the images, no matter if the player is named (Mac) or lettering (PC). This is how "export as catalog of ' works, that is, it creates a 'package', alias a parent folder, containing the catalog and a replica of the folder hierarchy to exported along with the catalog images. Take this 'package' to another system (same OS or not) and "it works" even if the drive letter is different or the operating system is different... because the relative path of the image catalogue is always the same.

    I have not tested this cross-platform (if I have between various PC systems with letters of different readers) so for me it's still just a theory, but there may be others who have done this successfully.

  • How to get the text block, given anchor (~ a)

    I need to dynamically position anchored with anchor text blocks (but the relative position will be different for each anchor). If I grep ~ i can get the anchor marker - how to get the text block once I got this marker?

    Thank you

    The marker "anchor" is a character of "simple".

    So you can do the following if you have identified the character (and in this example selected it):

    //Start with an "Anchor Marker" selected:
    var myCharacter = app.selection[0];
    
    if (myCharacter.texts[0].textFrames.length == 1){
    
    var myAnchoredTextFrame = myCharacter.texts[0].textFrames[0];
        //do something with the anchored text frame:
        myAnchoredTextFrame.fillColor = "Yellow";
    
        };
    

    You can set the myCharacter variable differently, if you know the index of the character according to his history of parent.

    Or if you have found the character as part of a search GREP or TEXT by ExtendScript (JavaScript).

    Uwe

  • How to catch the exception in the sliders

    Hello

    How to catch the exception no. DATA FOUND/other exceptions with the cursor
    DECLARE
    CURSOR c1 IS SELECT * FROM EMP WHERE empno = 1234;
    BEGIN
    FOR i IN c1 LOOP
    DBMS_OUTPUT.PUT_LINE(i.ename);
    END LOOP;
    END;
    so 1234 is not in my table, how to trap this.could help me please

    Published by: user4587979 on 27 May, 2010 03:46

    Maybe it's

    declare
      CURSOR c1 IS SELECT * FROM EMP WHERE empno = 1234;
      lemp c1%rowtype ;
    begin
      open c1;
      loop
        fetch c1 into lemp;
        exit when c1%notfound;
        DBMS_OUTPUT.PUT_LINE(lemp.ename);
      end loop;
      if c1%rowcount = 0 then
        raise no_data_found;
      end if;
      close c1;
    end;
    
  • call another proc and passing the values in the exception block

    Hello
    I'm trying to call the procedure another passing values in the exception block... but I couldn't m figure out how would the values in the exception block
    create or replace procedure test_proc 
    is 
       cursor test_cur is 
         select update_dt from test_tbl;   
         
         test_rec test_cur%rowtype;
    
        begin
            for test_rec in test_cur
            loop
                begin 
                    insert into test_tbl values (test_rec.update_dt);
                    commit;
                    exception 
                       when others then
                         rollback;
                    --      test_proc2(update_dt)       --     want to call another procedure and want to pass that update_dt here ; this process will insert the update_dt into the message table    
                       commit; 
                     
            end loop;  
            
        end;
         
     
    
    My question is how do i pass value(update_dt) into the exception block or do i need to create any varaible ?? any idea 
    Thank you very much!!

    BTW, you can still use SQL % BULK_EXCEPTIONS even if you don't use EXCEPTION to LOG. You just can't use ORA-24381, since it will not be raised. Using SO many OTHER instead. And of course, there will be only one element in SQL % BULK_EXCEPTIONS:

    SQL> CREATE TABLE emp_temp AS SELECT * FROM emp;
    
    Table created.
    
    SQL> DECLARE
      2     TYPE empno_tab IS TABLE OF emp.empno%TYPE;
      3     emp_sr empno_tab;
      4     errors NUMBER;
      5     dml_errors EXCEPTION;
      6     PRAGMA EXCEPTION_INIT(dml_errors, -24381);
      7  BEGIN
      8     SELECT empno BULK COLLECT INTO emp_sr FROM emp_temp;
      9       FORALL i IN emp_sr.FIRST..emp_sr.LAST --SAVE EXCEPTIONS
     10         UPDATE emp_temp SET job = job || '_SR'
     11            WHERE emp_sr(i) = emp_temp.empno;
     12  EXCEPTION
     13    WHEN OTHERS THEN -- Now we figure out what failed and why.
     14     errors := SQL%BULK_EXCEPTIONS.COUNT;
     15     DBMS_OUTPUT.PUT_LINE('Number of statements that failed: ' || errors);
     16     FOR i IN 1..errors LOOP
     17        DBMS_OUTPUT.PUT_LINE('Error #' || i || ' occurred during '||
     18           'iteration #' || SQL%BULK_EXCEPTIONS(i).ERROR_INDEX);
     19            DBMS_OUTPUT.PUT_LINE('Error message is ' ||
     20            SQLERRM(-SQL%BULK_EXCEPTIONS(i).ERROR_CODE));
     21     END LOOP;
     22  END;
     23  /
    Number of statements that failed: 1
    Error #1 occurred during iteration #2
    Error message is ORA-12899: value too large for column "SCOTT"."EMP_TEMP"."JOB"
    (actual: 11, maximum: 9)
    
    PL/SQL procedure successfully completed.
    
    SQL> DROP TABLE emp_temp;
    
    Table dropped.
    
    SQL> 
    

    SY.

  • How to manage the runtime at the stage of PreUUT error when running in parallel mode

    I would like to run Test DUT in parallel mode, and some actions are made in PreUUT of this kind of reading serial number and control of the aircraft.
    The model of process don't goto PostUUT step when the runtime error occurs at the stage of PreUUT, so I would like to add a few things to check if error in the cleaning of the sequence and return to the configuration at PreUUT stage, but I think it's jumping all the actions of installation and the main stage?

    What should I do if I want to go back to run PreUUT again after the first run when the runtime error occurs?

    Or, is it a good way to handle this kind of error withour restart of the program?

    Bandaged,

    There is no decent way to do this. The reason is the following: TestStand assumes that failure in the facility to a unique testsocket mechanism, it is senseless to proceed with this testsocket at all. It is recommended to manage the routines of judgment in this case using the SequenceFilePostStepRuntimeError callback. You also can use this callback to execute a loop on the step that creates the error until the error is resolved.

    By default, TestStand does not support a tribute of the error but the proceedings concerning the execution of shots. You can just ignore the error (deletion of the error indicator) or you can implement your own features. For example, you can set a custom fault indicator which will be evaluated as a first step in your hand. If the flag is set, ignore you everything in your hand.

    I know that this suggestion seems not to be a good idea because it's 'hack mack', but it solves your problem. TestStand, as already the State evaluates the execution errors that occur in the PreUUT as to the deficiencies of the system and carry out any checks is not suggested.

    Norbert

  • How to manage the threads for TCP communication?

    Hello

    I have a project to control two separate applications (C++ and LabView) and two of them are implemented as server. Another client program (C++) is used to control applications. Communication between them are implemented using TCP socket. The client program sends the message to start or stop tasks on servers. The client program also sends time (HH) with the message start and end to determine when to start or stop.

    Application in C++ (server): Listening to the request for the connection and when gets one, it creates a thread of communication allowing to manage this and listen again to another connection. Communication wire crossing of handles and messages when it receives a start or a stop message, it creates a thread of timer with the received time to trigger a task at the time specified. And after that he expects the client message. So, here, when the thread (communication, timer) is necessary, it is created.

    In LabView (server): I tried to create the same as the C++ server. But, in manual of LabView and other discussions of the forum, I got that LabView is multithreaded and it can be done with the help of the loop independent. So, I had to create four loops in a diagram:

    1. wait the new connection

    2 manage the communication for the already received connection

    3. start the timer

    4 stop the timer

    and they are executed at the beginning of execution and communication between them are managed using local variables. But, 2, 3 and 4th loop can handle only one connection and it can handle another if the current is closed. The C++ application can handle multiple connections by creating the thread when it is necessary, but not at the beginning of the application.

    Is there a better way to implement this in LabView?

    Is it possible to manage multiple connections and create the diagram node/block (such as a wire) dynamically as C++?

    Thank you.

    There are several ways to do so in modern LabVIEW and you should probably seek the Finder example for TCP examples. The classic is to transfer the refnum of connecting the listening loop in a communications loop that adds to an array of login credentials and then constantly iterates through this array to make the communication. He works on LabVIEW 4.0 perfectly for me even for applications with basic HTTP communication protocol. But you must make sure that the communication for a connection is not delaying his work for reasons that would delay the handling of other connections too, because they are really of course worked on sequentially. If you encounter an error, the connection ID is closed and removed from the table.

    The other is that create you a VI that makes your entire communication and ends on an error or when the order quite. Make this reentrant VI and then launch it through VI server as the instance home, passing the refnum of newly received connection form the listening loop. Then use the method to Run let start and operate as an independent thread.

    For all these, you should be able to find an example in the example Finder when searching for TCP.

  • How to manage the rotaion of parts of Vision Assistant 8.0

    Hi, I'm new to Vision Assistant and my question concerns the rotation of a play about a test table. I found a tutorial to manage such situations for Vision Assistant 8.6. Here, he shows you how to rotate the region of interest and build a coordinate system based on the location and orientation of the reference model. The defined coordinate system option is not available in the category of Vision Assistant 8.0 image processing and I wanted to know how I could implement this in Vision Assistant 8.0?

    Well it worked, but with corresponding geometry, for some reason any I can't work with any special criteria but I'll work on that.

    Thanks Ajmal

    If someone wants to know how it is here. In Vision Assistant 8.0, I did a calibration of the image first, then a game of geometry. In LabVIEW I extracted the angle of geometric correspondence, 360 and cable adds the value in IMAQ image inversion.

  • How can you correct - an error occurred in ejecting ' DVD RW drive (e) "."

    I was wondering what is happening. Works perfectly an hour ago now, it does not respond when I press the button to eject the trey. When I try right click then eject it comes with, an error occurred while ejecting ' DVD RW drive (e) "." What is happening to her?

    Hi Scorpion1138,

    Please use the forum.

    Quick question, have you tried to reboot your PC and eject the DVD until windows loads? It might just not be well wedged into the slot.

    Give that a try and let us know if it worked for you.

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

  • How Pix manages the rare IP protocol packets

    Does anyone know of a document explaining how the Pix handles, regarding the State, rare IP protocol packages such as ESP, AH, OSPF, GRE, etc. ? I'm concred with traffic flowing through the pix is not intended.

    I understand how TCP, UDP, and ICMP packets are handled, but I can't find anything on all others.

    Thank you.

    In General, the Pix must inspect any protocol passes through it accepts for TCP and UDP. The exception is a protocol which is managed by a '' correction '' like PPTP which has a correction to allow GRE (Protocol 47) traffic that results.

    If you want a different protocol than UDP/TCP to be allowed to get THROUGH, you almost create an ACL entry for her.

    The other exception is the traffic to the Pix itself as host. ACL have absolutely no effect on the traffic to the Pix as the host. For example, the packets OSPF intended for the Pix when running OSPF. Or packages ESP for the Pix for a VPN tunnel, it stops. Or ICMP traffic to the Pix itself (controlled using the command [icmp]). ACL don't apply to transit traffic.

  • How to manage the selection with the box in a table

    Hello


    JDev 11.1.2.4

    I have a table with an attribute of EO/VO, transitional to manage the selection. This attribute is displayed as a check box. The user makes a selection by clicking on the checkbox. Then, the user clicks on a button that displays a pop-up window. Inside of this pop-up window, that user can create, insert, delete, or update values in a table based on an other EO/VO.

    When the user clicks OK, the pop-up window is closed, then the data is committed.

    When the user clicks Cancel, the popup is closed and the changed data are ignored. To remove the data, I call a Rollback. It works fine, but all the transitory values are lost which is correct because of the discount after the cancellation.

    It's a problem because the user must be able to open the pop-up window several times with the same selection. This means that the restoration is not appropriate in this case.

    How to ignore data edited inside the pop-up window and keep the selection?

    Thank you

    You can try to put the popup in his own taskflow and define a backup point before entering the taskflow. When the user cancel the editing restore you to previous backup. This should dispel the changes.

    Or you save the selected rowkeys, call rollback and backward selection later.

    Timo

  • How to manage the assets Conference on Telepresence server controlled by the conductor

    Colleagues, Hello.

    How to add additional participants to the already begun scheduled conference or permanent on Telepresence server controlled by the conductor? Or so... How to make the call to the Conference on the telepresence server controlled by a number of additional connected participants of the conductor?

    I do not know the TMS, but I do not see active conference control features in its options. On the telepresence server, there is limited management capacities.

    A driver controlled TelePresence server has no conference control what so ever, as its all managed by TMS. In TMS you use Conference Control Center under surveillance to manage the scheduled conference. Conference ad hoc permanent that's not demand through TMS, endpoints will have to deal in itself.

Maybe you are looking for

  • C870D - 10-X satellite keyboard problem, when you press the AltGr key

    When I press a key ONCE everything in now ALT GR for a @ for example, two @ appears. Like that @. I pressed ONCE only. What is going on? It's the same with any key I press: @££ $$ {[]}--------. Yes everyone, except:-(slash) Thank you.

  • HP LaserJet 1020 and Windows 8

    Hello I have a HP 1020 Laserjet connected to one of my Windows 7 x 64 PC, the printer is shared on my home network. Everything works fine if I feel of other widows 7 x 64 PC on the network. I converted a PC Windows 8 x 64 and I can not print any file

  • Problem with the blue screen on Windows 7

    Hello world I'm looking inform my computer crashes a lot when editing in Adobe Premiere Pro. Computer guard market back but a small window with the following message: windows has recovered from an unexpected shutdown Signature of the problem:Problem

  • My nvidia graphics card does not work when I install microsoft visual stedio

    as say the title my nvidia graphics card does not work when I install microsoft visual studio 2013How can I stop this from happening We know what to do?

  • Cannot access Windows Live account

    Original title: window Live Hello can you tell me why I cannt get into Windows Live, was fine this morning, but cannt get into it now?