How to get a 'when others' exception raised.

the 'when others' exception is raised usualy after a error occurs, but when does this actually occur? could some1 give an example??
usually some error occurs and then a inbuilt exception is raised. but 'others' exception never seems to take place?

The OTHERS handler takes control when the exception is not handled by any previous handlers.
Here, we'll try to divide by zero. The no_data_found handler does not handle this error so control passes to the OTHERS section:
sql>declare
  2    n  number;
  3  begin
  4    n := 1/0;
  5  exception
  6    when no_data_found then
  7      dbms_output.put_line( 'no data found exception' );     
  8    when others then
  9      dbms_output.put_line( 'when others exception' );
10  end;
11  /
when others exception
PL/SQL procedure successfully completed.Now, we'll try an operation which will raise the no_data_found exception. Here the ndf handler does handle the error and control never passes to the OTHERS section:
sql>declare
  2    n  number;
  3  begin
  4    select 0
  5      into n
  6      from dual
  7     where dummy is null;
  8  exception
  9    when no_data_found then
10      dbms_output.put_line( 'no data found exception' );
11    when others then
12      dbms_output.put_line( 'when others exception' );
13  end;
14  /
no data found exception
PL/SQL procedure successfully completed.

Similar Messages

  • How to get header when we use CL_GUI_FRONTEND_SERVICES= GUI_DOWNLOAD

    Hi SDN's,
    Can u tell me how to get headers when we download data to excel with using (we are using DBF as file type in the following method )
    CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
    (We can't use GUI_DOWNLOAD)
    Thanks in advance..
    BR

    Hi,
    I m giving u a bdc code i hope ur prob ll be solved.
    *& Report  ZDTK_BDC_LT01
    *& PROGRAME TITLE : LT01
    *& AUTHOR         : D TARUN KUMAR
    *& MM CONSULTANT  : Mr. MRINMOYE CHAKRABORTY
    *& REQUEST NO.    : RD1K901995
    *& TRANSACTION ID : ZLT01
    *& PACKAGE        : ZTARUN
    *& DESCRIPTION : BDC REPORT TO UPLOAD INITIAL STOCK POSTING AND
    *&               STORAGE BINS THROUGH LT01.
    REPORT  ZDTK_BDC_LT01
           no standard page heading line-size 255.
    TYPE-POOLS: TRUXS.
    STRUCTURE DECLARATION
    TYPES : BEGIN OF TY_UPLOAD,
                     LGNUM(3),
                     BETYP(1),
                     BENUM(10),
                    BWLVS(3),
                     MATNR(18),
                    BISMT(18),
                     ANFME(16),
                    WERKS(4),
                    LGORT(4),
                     CHARG(10),
                    LETYP(10),
                    VLTYP(3),
                    VLBER(3),
                    VLPLA(10),
                    VLQNR(10),
                     NLTYP(3),
                    NLBER(3),
                     NLPLA(10),
                    NLQNR(10),
              END OF TY_UPLOAD.
    INTERNALTABLE & WORKAREA DECLARATION
    DATA : T_UPLOAD TYPE STANDARD TABLE OF TY_UPLOAD,
           T_BDCDATA TYPE STANDARD TABLE OF BDCDATA,
           T_BDCMSGCOLL TYPE STANDARD TABLE OF BDCMSGCOLL,
           W_UPLOAD TYPE TY_UPLOAD,
           W_BDCDATA TYPE BDCDATA,
           W_BDCMSGCOLL TYPE BDCMSGCOLL,
    GLOBLE DECLARATION
           G_FLNAME TYPE STRING,
           G_MESSAGE(70) TYPE C,
           IT_RAW TYPE TRUXS_T_TEXT_DATA,
    GLOBLE DECLARATION
           WA_OPT TYPE CTU_PARAMS.
           WA_OPT-UPDMODE = 'A'.
           WA_OPT-DEFSIZE = 'X'.
           WA_OPT-DISMODE = 'A'.
    SLECTION SCREEN DECLARATION
    SELECTION-SCREEN : BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    SELECTION-SCREEN SKIP 2.
    PARAMETER : P_FILE LIKE RLGRAP-FILENAME OBLIGATORY.
    SELECTION-SCREEN SKIP 2.
    SELECTION-SCREEN : END OF BLOCK B1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
    PERFORM GET_FILENAME.
    START-OF-SELECTION.
    PERFORM UPLOAD_DATA.
    *PERFORM GET_FINAL.
    *PERFORM GET_MIGO.
    PERFORM SESSION.
    *PERFORM TEST.
           Start new screen                                              *
    FORM BDC_DYNPRO USING PROGRAM DYNPRO.
      CLEAR W_BDCDATA.
      W_BDCDATA-PROGRAM  = PROGRAM.
      W_BDCDATA-DYNPRO   = DYNPRO.
      W_BDCDATA-DYNBEGIN = 'X'.
      APPEND W_BDCDATA TO T_BDCDATA.
    ENDFORM.
           Insert field                                                  *
    FORM BDC_FIELD USING FNAM FVAL.
    IF FVAL <> NODATA.
        CLEAR W_BDCDATA.
        W_BDCDATA-FNAM = FNAM.
        W_BDCDATA-FVAL = FVAL.
        APPEND W_BDCDATA TO T_BDCDATA.
    ENDIF.
    ENDFORM.
    *&      Form  GET_FILENAME
          TEXT
    FORM GET_FILENAME .
    CALL FUNCTION 'F4_FILENAME'
    EXPORTING
       PROGRAM_NAME        = SYST-CPROG
       DYNPRO_NUMBER       = SYST-DYNNR
       FIELD_NAME          = 'P_FILE'
    IMPORTING
       FILE_NAME           = P_FILE
    ENDFORM.                    " GET_FILENAME
    *&      Form  UPLOAD_DATA
          text
    form UPLOAD_DATA .
    CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
      EXPORTING
      I_FIELD_SEPERATOR          =
        I_LINE_HEADER              = 'X'
        I_TAB_RAW_DATA             = IT_RAW
        I_FILENAME                 = P_FILE      "WORK TABLE
      TABLES
        I_TAB_CONVERTED_DATA       = T_UPLOAD[]    "ACTUAL DATA
    EXCEPTIONS
       CONVERSION_FAILED          = 1
       OTHERS                     = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    endform.                    " UPLOAD_DATA
    *&      Form  SESSION
          text
    FORM SESSION .
    *sort t_upload by bismt.
    LOOP AT T_UPLOAD INTO W_UPLOAD.
    REFRESH T_BDCDATA.
    *CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
       input         = W_UPLOAD-CHARG
    IMPORTING
      OUTPUT        = W_UPLOAD-CHARG .
    *CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
       input         = W_UPLOAD-VLBER
    IMPORTING
      OUTPUT        = W_UPLOAD-VLBER .
    *CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
       input         = W_UPLOAD-NLTYP
    IMPORTING
      OUTPUT        = W_UPLOAD-NLTYP .
    *CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
       input         = W_UPLOAD-NLBER
    IMPORTING
      OUTPUT        = W_UPLOAD-NLBER .
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        input         = W_UPLOAD-CHARG
    IMPORTING
       OUTPUT        = W_UPLOAD-CHARG .
    DATA : BWLVS(3),
           LGORT(4),
           WERKS(4),
           CHARG(10),
           LETYP(10),
           VLTYP(3),
           VLBER(3),
           VLPLA(10),
           VLQNR(10),
           NLTYP(3),
           NLBER(3),
           NLQNR(10).
    DATA : W_MATNR(18).
    *SELECT SINGLE MATNR FROM MARA INTO W_MATNR
                      WHERE BISMT = W_UPLOAD-BISMT.
    BWLVS = '999'.
    LGORT = '3500'.
    WERKS = '1030'.
    LETYP = 'E1'.
    VLTYP = '998'.
    VLBER = '001'.
    VLPLA = 'AUFNAHME'.
    NLTYP = '354'. "(packaging material)
    *NLTYP = '353'. "(spareparts material)
    NLBER = '001'.
    *include bdcrecx1.
    *start-of-selection.
    *perform open_group.
    perform bdc_dynpro      using 'SAPML03T' '0101'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'LTAP-CHARG'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'LTAK-LGNUM'
                                  W_UPLOAD-LGNUM.  "'350'.
    perform bdc_field       using 'LTAK-BENUM'
                                  W_UPLOAD-BENUM.  "'1000000000'.
    perform bdc_field       using 'LTAK-BETYP'
                                  W_UPLOAD-BETYP.  "'P'.
    perform bdc_field       using 'LTAK-BWLVS'  BWLVS.    "'999'.
    perform bdc_field       using 'LTAP-MATNR'
                                  W_upload-MATNR.    "'40000009'.
    perform bdc_field       using 'RL03T-ANFME'
                                  W_UPLOAD-ANFME.    "'1,000'.
    perform bdc_field       using 'LTAP-WERKS' WERKS.    "'1030'.
    perform bdc_field       using 'LTAP-CHARG'
                                  w_upload-charg.
    perform bdc_dynpro      using 'SAPML03T' '0102'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'LTAP-NLPLA'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'RL03T-ANFME'
                                  W_UPLOAD-ANFME.    "'1,000'.
    *perform bdc_field       using 'LTAP-ALTME'
                                 'KG'.
    perform bdc_field       using 'LTAP-LETYP' LETYP.    "'E1'.
    *perform bdc_field       using 'LTAP-CHARG' W_UPLOAD-CHARG.    "'0000000101'.
    perform bdc_field       using 'LTAP-VLTYP' VLTYP.    "'998'.
    perform bdc_field       using 'LTAP-VLBER' VLBER.    "'001'.
    perform bdc_field       using 'LTAP-VLPLA' VLPLA.    "'AUFNAHME'.
    perform bdc_field       using 'LTAP-NLTYP'
                                   W_UPLOAD-NLTYP.       "'351'.
    perform bdc_field       using 'LTAP-NLBER' NLBER.    "'001'.
    perform bdc_field       using 'LTAP-NLPLA'
                                  W_UPLOAD-NLPLA.    "'01 00 01'.
    *perform bdc_transaction using 'LT01'.
    *perform close_group.
    CALL TRANSACTION 'LT01' USING T_BDCDATA
                            MODE 'A'
                          UPDATE 'A'
                            OPTIONS FROM WA_OPT
         MESSAGES INTO T_BDCMSGCOLL.
    IF SY-SUBRC <> 0.
    READ TABLE T_BDCMSGCOLL INTO W_BDCMSGCOLL INDEX 1.
        CALL FUNCTION 'FORMAT_MESSAGE'
          EXPORTING
            ID        = SY-MSGID
            LANG      = 'EN'
            NO        = SY-MSGNO
            V1        = SY-MSGV1
            V2        = SY-MSGV2
            V3        = SY-MSGV3
            V4        = SY-MSGV4
          IMPORTING
            MSG       = G_MESSAGE
          EXCEPTIONS
            NOT_FOUND = 1
            OTHERS    = 2.
        IF SY-SUBRC = 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          WRITE : / W_upload-matnr ,'-----' , G_MESSAGE.
          REFRESH T_BDCMSGCOLL.
        ENDIF.
        ENDIF.
    *clear : w_matnr, w_upload.
    ENDLOOP.
    ENDFORM.                    " SESSION

  • How to get sound when my laptop is hooked to my tv w/hdmi cable?

    how to get sound when my laptop is hooked to my tv w/hdmi cable?  it's a hd tv and my mac's os 10.6.8
    tried using an external speaker both w/the computer and then the tv, but neither worked......
    Message was edited by: bevmex

    Hi,
    Open windows Control Panel, open Device Manager and open up Display Devices - make a note of the hardware listed here i.e. ATI, NVidia or Intel.
    Next, connect your notebook via HDMI to your Tv.  Right click the speaker icon in the Taskbar and select Playback Devices.  Left click once ( just to highlight the entry ) the HDMI Output that has the same name as your display adapter and then click the Set Default button - see if you now have audio.
    Regards,
    DP-K
    ****Click the White thumb to say thanks****
    ****Please mark Accept As Solution if it solves your problem****
    ****I don't work for HP****
    Microsoft MVP - Windows Experience

  • How to get notified when changes happen on Hyper-V host or VMs

    Is there a way to get notified on Hyper-V host or VM changes? Our intention is to notify the system-administrators on any changes.
    1. How to get notified when new VM is created (or deleted) on Hyper-V.
    2. How to get notified when any memory/CPU/disk is added (or deleted) on any VM(s).
    In general: 
    - Get notified when any changes happens to Hyper-V host.
    - Get notified when any changes happens on any VMs.
    Our target servers are Windows Server(2008, 2008 R2, 2012, and 2012 R2)
    We tried to get the notification using "Event Viewer" on different Windows servers (2008, 2008 R2, 2012, and 2012 R2)
    We were able to get event-logs only on one of our 2012 R2 server as described below on creation/deletion of VMs (on another 2012 R2 server, we did not got any such event, Is there any setting required on host computer to get Hyper-V event-logs in "Event
    Viewer"?)
    Log Name:      Microsoft-Windows-Hyper-V-VMMS-Admin
    Source:        Microsoft-Windows-Hyper-V-VMMS
    Date:          12/18/2014 1:21:45 AM
    Event ID:      13002
    Task Category: None
    Level:         Information
    Keywords:      
    User:          SYSTEM
    Computer:      HPHyper-V.COMPUTERNAME.lab
    Description:
    A new virtual machine 'TestVM' was created. (Virtual machine ID A0FED305-7B1A-4BB5-952C-BA9634ACDA45)
    Log Name:      Microsoft-Windows-Hyper-V-VMMS-Admin
    Source:        Microsoft-Windows-Hyper-V-VMMS
    Date:          12/17/2014 10:57:01 PM
    Event ID:      13003
    Task Category: None
    Level:         Information
    Keywords:      
    User:          SYSTEM
    Computer:      HPHyper-V.COMPUTERNAME.lab
    Description: The virtual machine 'TestVM' was deleted. (Virtual machine ID A0FED305-7B1A-4BB5-952C-BA9634ACDA45)

    Thanks for your reply,
    Just to make it more clear:
    In our environment we have enabled Hyper-V on following Windows servers: 2012 R2, 2012, 2008 R2, 2008. The environment is very dynamic, VMs are getting created and deleted very frequently. Our intention is to get notified by any means on VM creation/deletion,
    currently we are relying on event-logs (we are OK with any different mechanism for such notification if there exists, i,e other than event-logs)
    We were able to get event-logs only on few of our 2012 R2 server on creation/deletion of VMs. On another 2012 R2 server, we did not got any such event (do we need to make some settings on 2012 R2 to get events? If yes, what are those settings).
    Also we are not getting any such event of VM creation/deletion on our Windows Server 2012, 2008, 2008 R2. Is there any setting required on hese host computer to get Hyper-V event-logs in "Event Viewer" for VM creation/deletion?

  • How to get event when app is minimized.

    How to get event when app is minimized in only windows app, not phone version.

    Hi,
    Suspending Event will be called when a windows store app is minimized. It will not hit the Suspending Event when minimised while debugging, So you need to trigger it manually from the VisualStudio Toolbar.
    Also Read
    Application Lifecycle for windows apps
    Pradeep AJ

  • How to get event when any library object added to indesign doc?

    I want to do some operation when any library object is added to doc. So please tell me how to get event when any library object is added to the doc. better provide some code snippet.

    Daves61,
    I need to clarify what kind of event you're interested in.
    1. When you click once on page/spead widget in the Pages panel and only widget becomes selected. The layout window remains unchanged. OR
    2. When you doubleclick on page/spread widget the selected master spread appears in the layout window.
    In the first case you work with Pages panel.
    Have a look to file PageTransitionsPanelObserver.cpp from SDK. 
    PageTransitionsPanelObserver::LazyUpdate()
    In the second case you work with Layout window.

  • How to get group when the data source from system instead of UME database

    Hig guys,
    How to get group when the data source comes from backend system instead of UME database?
    I tried to use
    IUMPrincipal RefGroup = WPUMFactory.getGroupFactory().getGroup(groupName);
    But I was not able to get the group. But in "UserAdministrator", I can find this groupName.
    Which kind of API can I use?
    Thanks in advance!
    Regards,
    Liying
    Message was edited by:
            Liying Wang

    Ok,
    try this:
    com.sapportals.portal.security.usermanagement.IGroupFactory ep5GroupFactory = userManagementService.getGroupFactory();
    IGroupFactory groupFactory = UMFactory.getGroupFactory();
    com.sap.security.api.IGroup group = groupFactory.getGroupByUniqueName(groupName);
    IUMPrincipal ep5Principal = ep5GroupFactory.getEP5Group(group);
    This should do the trick,
    Romano
    PS: and thanks for the stars!

  • How to get value when OAMessageLovInputBean Change

    How to get value when OAMessageLovInputBean Change
    I want to get lov value atfer user select value return page

    As you wanna get the value in process form request, get the value from the VO column attached to the bean, if not you can attach a tranient Vo attribute!
    --Mukul                                                                                                                                                                                                                                                                                                                                                                               

  • How to get tools and other bars back in view after deleting show-bar?

    How to get tools and other bars back in view after deleting show-bar?

    Hello Jouko.
    You can go into View > Toolbars and select the ones you want to see. If you can't see the menu bar you can simply tab ALT on your keyboard (I think F10 works too) to show it.

  • How to get data from other programs output?

    Hi gurus,
    I have told to do the following can you please help me out.
    In SM35 created many batch no. The user would like to know automatically when the session is not ok (error status).
    In return of the first program RSBDCBTC_SUB we will get the queues ie QID and QSTATE.
    I have told to create new Z-prog.
    In that Z-prog how can i get list of QID from the result (Output) of the first prog(RSBDCBTC_SUB )?
    How i get that particular QIDs in my Z-prog?
    Thanks in advanced.

    Hi
    Senthis,
    You can use IMPORT and EXPORT or SET and GET
    IF you take the F1 help on these KEY words it will take you to the KEY word documentation where you can find an example
    of Go to TCode ABAPDOCU
    where you can find an example for the same
    Regards
    Ramchander Rao.K

  • How to get text when mousing over image?

    Hey there, I am extremely new to Flash, but know other Adobe programs so tend to learn quickly.
    I desperately need to find out how to get text to pop up when i mouse over PART of the image and i havent been able to find any help online in the last two days (pulling my hair out in stress).
    Now i uploaded a rough mock up i did on Photoshop, so you can see when i mouseover the top layer of the cake i need a line to stretch out and the text to pop up at the end of it. Similarly if i moused over the cherry another piece of text needs to come up in the same manor.
    Also since i need it to be a website link so what format do i open it with when i go to FILE- NEW?
    Honestly thank you so much in advance to anyone that helps

    First you have to choose if you want to handle devices. If not and you want to stay in Flash I'll stick on topic.
    In the HTML version you could either use a good old fashioned image map (they're still fine in the HTML5 era) or you could use a layering technique (here's a random layering example).
    In Flash you can do it a few different ways. If you intend on keeping the image intact as a single object then you'll be essentially doing the same as an image map. You can draw invisible hitareas on the various parts of the object and have those areas trigger a specific function that will display your text. If you break up the image into the separate parts then you can directly assign those parts to fire off a function themselves.
    First I'd like to know your desired direction.

  • How to get notify when new Email comes in...

    hi, any idea on how to get notify from phone when there is new email comes in to mailbox with specific key words in the subject, says like "urgent" ..... what are the components that i need to integrate with??
    messaging version 6.2

    Hi,
    Off the top of my head there are two ways:
    1. Use the ENS service to notify when messages arrive - filter out the ones you want. This is going to require some programming and a way to send the notification to the phone.
    http://docs.sun.com/app/docs/doc/819-2655
    2. Use a user-level sieve filter to send a copy of the messages you want to another email address which triggers an SMS.
    http://docs.sun.com/app/docs/doc/819-2650
    Regards,
    Shane.

  • How to get notified when another device is tracking my iphone

    I will like to know how can get an email when someone else is tracking my iphone from another device

    Don't give anyone else your Apple ID password and they won't be able to track you.

  • How to get imei when phone is los

    how go get imei of iphone 5 when stollen

    Ask your carrier - they have it.  It's also on the box

  • When Others not raised for Dynamic SQL occasionally

    Hi All,
    Please consider some part of my PL/SQL code below.
    FOR rec IN cur_job_steps
    LOOP
    update_job_step_status(p_sector,
    p_job_name,
    rec.step_name,
    'Running',
    NULL,
    SYSDATE,
    NULL
    -- Execute Job Step Function
    EXECUTE IMMEDIATE 'BEGIN ' || rec.step_function || '; END;';
    -- Set Job Step End Status
    update_job_step_status(p_sector,
    p_job_name,
    rec.step_name,
    'Successful',
    NULL,
    NULL,
    SYSDATE
    END LOOP;
    EXCEPTION
    WHEN OTHERS
    THEN
    ROLLBACK;
    -- Set Job Failed Status
    update_job_status(p_sector,
    p_job_name,
    'Failed',
    'Could Not Complete DB Job: ' || SQLERRM,
    NULL,
    SYSDATE
    -- Set Job Step Failed Status
    END;
    rec.step_function is a procedure without any "When Others" clause. When that exception occurs I am expecting the "When Others" clause of the calling procedure is not capturing it some times. Is there any limitation to this? Any info in this regards would be really useful.
    Thanks in advance.
    Best Regards
    Srikanth Tirandas

    Could not reproduce.
    SQL> ed
    Wrote file afiedt.buf
    1 create or replace procedure my_proc
    2 as
    3 v_num number;
    4 begin
    5 v_num := 1 / 0;
    6* end;
    SQL> /
    Procedure created.
    SQL> ed
    Wrote file afiedt.buf
    1 begin
    2 begin
    3 execute immediate 'begin my_proc; end;' ;
    4 end;
    5 exception
    6 when others then
    7 dbms_output.put_line(sqlerrm);
    8* end;
    SQL> /
    ORA-01476: divisor is equal to zero
    PL/SQL procedure successfully completed.
    Can you provide code for your function when it does not work ? It seems some "rec.step_function" are coded to handle exceptions and hence you don't get any in outer loop.

Maybe you are looking for

  • Problem with file.listFiles() of File class??

    Hi all friends, Iam facing with one peculiar problem,Iam using [file.listfiles()] method of File class in my program and this method of file class introduced in Java2.Now when Iam runing on Mac OS classic(8 to 9)[it is my client requirement they can'

  • FCP 4.0 COMPRESSOR DOESN'T WORK AFTER UPDATING TO 10.11.4

    CAN'T SELECT COMPRESSOR IN MY FCP 4.0 SINCE I UPDATED TO 10.11.4

  • Loss of music/apps

    Have recently had my ipod touch repaired and restored which of course erased all apps and music on it. Files were not backed up. Is their anyway apple will allow me to 're-download' the files i have lost

  • Cannot print PO document from ME9F

    Dear Expert, Hi, I got trouble when printing out the PO document. Here, I have created new PO type (PO Mold) with series number 457xxxxx but the problem is i cant print out the PO 457xxxxx from ME9F. there is a message : no suitable purchasing docume

  • How do I Get Album Art for Some Tracks Only?

    I feel really stupid for asking this but I have tried to find out how to do it to no avail! I only want to get the album art for actual albums but whenever I click on "Get Album Artwork" it goes through my whole library! I have tried by highlighting