How to handle the exception in AWT-EventQueue-0?

This is my code:
import javax.swing.JFrame;
public class MainFrame extends JFrame {
     public MainFrame(){
          init();
     public void init(){
          setSize(100,100);
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
public class SubFrame extends MainFrame implements ActionListener{
     private JButton button1 = null;
     public SubFrame(){
          super();
     public void init(){
          super.init();
          button1 = new JButton("button1");
          add(button1);
          button1.addActionListener(this);
     public void actionPerformed(ActionEvent e) {
          // TODO Auto-generated method stub
          button1.setEnabled(false);
      * @param args
     public static void main(String[] args) {
          // TODO Auto-generated method stub
          (new SubFrame()).setVisible(true);
}When I click the button, this exception will be thrown:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
     at swing.SubFrame.actionPerformed(SubFrame.java:23)
     at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
     at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
     at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
     at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
     at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
     at java.awt.Component.processMouseEvent(Component.java:6038)
     at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
     at java.awt.Component.processEvent(Component.java:5803)
     at java.awt.Container.processEvent(Container.java:2058)
     at java.awt.Component.dispatchEventImpl(Component.java:4410)
     at java.awt.Container.dispatchEventImpl(Container.java:2116)
     at java.awt.Component.dispatchEvent(Component.java:4240)
     at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
     at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
     at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
     at java.awt.Container.dispatchEventImpl(Container.java:2102)
     at java.awt.Window.dispatchEventImpl(Window.java:2429)
     at java.awt.Component.dispatchEvent(Component.java:4240)
     at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
     at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
     at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
     at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
     at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)

Darryl.Burke wrote:
Hmm. Interesting sequence of execution.
+-- new SubFrame () calls the sub class constructor
+----  which calls the super class constructor explicitly
+------  which calls init () of the sub class
+--------  which calls init () of the super class
and only after all these calls return, the declaration-cum-assignment of button1 is executed, which makes button1 null.
(Discovered by putting a breakpoint on that line and debugging in NetBeans)
With one change, button1 will not be null and the breakpont is not reached.private JButton button1;// = null;What's not clear is why the declaration-cum-initialization takes place after the constructor code executes, shouldn't it run before the constructor?
It does run before the SubFrame constructor, but it runs after the super class constructor, which is exactly how the language specification says it should be.
There was a similar thread a while back:
http://forum.java.sun.com/thread.jspa?threadID=5190252&messageID=9745092
Note that there is another "bad" habit involved (other than explicitly initializing member variables to null): that an overridden method is called from the super class constructor. That means that the overridden method will be executed before the object it belongs to has been fully initialized, and that will often lead to confusing behavior like this.

Similar Messages

  • How to handle the exception in GP(Exception : Activity could not be read)

    Hi all
    we are getting the GP exceptions  as  1) "Activity could not be read"  2) "Action has been stopped"
    3) error while processing the item can not be displayed
    Please let me know how to handle these exceptions in GP .
    currently i got some documents in SDN on GP exceptions but those are related to manual exceptions for example if you enterd wrong data in the inputfield then we can handle those exceptions then it will allow to enter the new value but the exceptions which i mentioned above are new it seems
    can you please let me know how to handle or solve those 3 exceptions
    Thanks
    bindu

    Hi Shikhil
    Thanks for your reply
    Please have a look below for exceptions which i am getting in GP and let me know how to handle these exceptions.
    1) "Activity could not be read"
    2) "Action has been stopped"
    3) error while processing the item can not be displayed
    if you give any idea/clue how to handle these exceptions then it would be great help to me
    Thanks
    Sunil

  • How to handle the Exception in GP using executable callabel object.

    Hi all,
            I handled an exception in GP using Background callable Object. That is working fine.
    (Ex: Exception_No_User_Found). The Problem is I am not able to handle the exceptions for normal callable object. I have done the same thing as i did in background callable object except implementing IGPBackgroundCallableObject Class.  I have created an WebDynpro DC Project where in getDescription method i declared an Exception and in execute method of component controller I caught the exception if no user found.
    Then i created an callable object for this simple DC project. but that is not working i could not catch the exception. when i execute the process it is asking the User ID if i give the wrong userId it is not refreshing back to the user id input form.
    But if i test that simple callable object separately it is throwing an Exception when I give the wrong input..
    but the same thing is working fine using background callable object.
    I couldn't handle the exception for the simple callable object or executable callable object.
    Please If anyone bring me the solution that would be appreciated.
    Thanks in advance.
    Regards,
    Malar.

    Hi Shikhil
    Thanks for your reply
    Please have a look below for exceptions which i am getting in GP and let me know how to handle these exceptions.
    1) "Activity could not be read"
    2) "Action has been stopped"
    3) error while processing the item can not be displayed
    if you give any idea/clue how to handle these exceptions then it would be great help to me
    Thanks
    Sunil

  • How to handle the Exception when RegisterEventProcessorAsync

    In our Cloud Service project, we have 2 instances for work role (deploy to Azure), the work role is consume events from the EventHub using EventProcessorHost).
    When we want to register EventProcessor to consume data (see below):
    await eventProcessorHost.RegisterEventProcessorAsync<eventProcessor>();
    Sometimes we will got the Exception:
    Microsoft.WindowsAzure.Storage.StorageException: The remote server returned an error: (412) There is
    currently a lease on the blob and no lease ID was specified in the request.. ---> System.Net.WebException: The remote server returned an error: (412)
    There is currently a lease on the blob and no lease ID was specified in the request..
      at Microsoft.WindowsAzure.Storage.Shared.Protocol.HttpResponseParsers.ProcessExpectedStatusCodeNoException[T](HttpStatusCode expectedStatusCode, HttpStatusCode actualStatusCode, T retVal, StorageCommandBase`1 cmd, Exception ex)
       at Microsoft.WindowsAzure.Storage.Shared.Protocol.HttpResponseParsers.ProcessExpectedStatusCodeNoException[T](HttpStatusCode expectedStatusCode, HttpWebResponse resp, T retVal, StorageCommandBase`1 cmd, Exception ex)
       at Microsoft.WindowsAzure.Storage.Blob.CloudBlobSharedImpl.<DeleteBlobImpl>b__1b(RESTCommand`1 cmd, HttpWebResponse resp, Exception ex, OperationContext ctx)
       at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.EndGetResponse[T](IAsyncResult getResponseResult)
       --- End of inner exception stack trace ---
       at Microsoft.WindowsAzure.Storage.Core.Util.StorageAsyncResult`1.End()
       at Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob.EndDeleteIfExists(IAsyncResult asyncResult)
       at Microsoft.WindowsAzure.Storage.Core.Util.AsyncExtensions.<>c__DisplayClass1`1.<CreateCallback>b__0(IAsyncResult ar)
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
       at Microsoft.ServiceBus.Messaging.BlobLeaseManager.<DeleteAllAsync>d__2a.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Microsoft.ServiceBus.Messaging.EventProcessorHost.<InitializeAsync>d__4.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Microsoft.ServiceBus.Messaging.EventProcessorHost.<StartAsync>d__e.MoveNext()
       --- End of inner exception stack trace ---
       at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
       at System.Threading.Tasks.Task.Wait()
    at awaiteventProcessorHost.RegisterEventProcessorAsync<eventProcessor>();
    If we got the Exception, we won’t got messages any more.
    From the Call Stack, we found it was cause by delete the Blob. So we wonder that, when we call
    RegisterEventProcessorAsync,
    the hub will delete the blob and renew one in Storage?
    If we delete the blob for the EventHub manually and then run our server again. It worked as usual.
    But we can do it like this way manually, so is there any way to handle the exception in code to make the EventProcessorHost worked?
    Thanks so much!

    If we use different blob container name for different EventProcessorHost, is it a workaround for the issue?
       var
    eventProcessorHost = new
    EventProcessorHost(
                    hostName,
                    hubName,
                    consumerGroupName,
                    serviceBusConnectionString,
                    storageConnectionString,
    leaseContainerName);

  • How to handle the exception com.sun.xml.internal.messaging.saaj.SOAPExcepn

    hi,
    I am accessing wsdl to get all the required data and the connection is establishing successfully thru java code but when i am calling the create user api the following exception is coming
    "com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: No NamespaceURI, SOAP requires faultcode content to be a QName"
    please tell me what is faultcode means and how to solve this exception

    Hi,
    Whenever there is any error inside the WebService or while it's processing ...it throws Exceptions ..We can handle these exception by our own to make the Exception details more readable.....For that we can create our own SOAPFault message...
    Please refer to the below Posts...
    1). If you are using JAXWS Style of WebService then : http://middlewaremagic.com/weblogic/?p=713
    2). If you are using JAXRPC Style of WebService then : http://middlewaremagic.com/weblogic/?p=721
    Thanks
    Jay SenSharma
    http://middlewaremagic.com/weblogic (Middleware magic Is Here)

  • How to Handle the exception while perform multiple insert in a procedure?

    CREATE OR REPLACE PROCEDURE MUL_INS_EXCE AS
    CURSOR C IS SELECT EMP_NO,EMP_NAME,EMP_AGE FROM EMP;
    EMP_RECORD EMP %ROWTYPE;
    BEGIN
    OPEN C;
    LOOP
    FETCH C INTO EMP_RECORD;
    EXIT WHEN C%NOTFOUND;
    INSERT INTO (SELECT NO,NAME,AGE FROM E1 WHERE AGE >=23 WITH CHECK OPTION VALUE(EMP_RECORD.EMP_NO,EMP_RECORD.EMP_NAME,EMP_RECORD.EMP_AGE);
    END LOOP;
    CLOSE C;
    EXCEPTION
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE(SQLERRM);
    END;
    I try to insert the record from emp into e1 table with some condition using the procedure. If run this procedure it insert record with check the age > =23. The conditions is not satisfied, exception is thrown procedure will terminate. Again i run this procedure, it will insert the from first. but i want, insert rest of the records. pls help me.

    >
    CHange your insert code like below....it should work
    If emp_record.age > 23 Then
    Insert into table name (fileld......) values(values)...............
    End If;;
    >
    CREATE OR REPLACE PROCEDURE MUL_INS_EXCE AS
    CURSOR C IS SELECT EMP_NO,EMP_NAME,EMP_AGE FROM EMP;
    EMP_RECORD EMP %ROWTYPE;
    BEGIN
    OPEN C;
    LOOP
    FETCH C INTO EMP_RECORD;
    EXIT WHEN C%NOTFOUND;
    INSERT INTO (SELECT NO,NAME,AGE FROM E1 WHERE AGE >=23 WITH CHECK OPTION VALUE(EMP_RECORD.EMP_NO,EMP_RECORD.EMP_NAME,EMP_RECORD.EMP_AGE);
    END LOOP;
    CLOSE C;
    EXCEPTION
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE(SQLERRM);
    END;
    I try to insert the record from emp into e1 table with some condition using the procedure. If run this procedure it insert record with check the age > =23. The conditions is not satisfied, exception is thrown procedure will terminate. Again i run this procedure, it will insert the from first. but i want, insert rest of the records. pls help me.

  • How to handle the exception

    I have worked out in similar fashion as given in site
    "http://stardeveloper.com/articles/display.html?article=2001101101&page=1"
    But iam not getting output.
    I used tomcat server.
    The result i got is
    Sending failed; nested exception is: javax.mail.MessagingException: Unknown SMTP host: mail.yourisp.com; nested exception is: java.net.UnknownHostException: mail.yourisp.com
    Please reply me at earliest.
    I need it for my project

    Hi,
    This is not the correct forum for questions such as these. This forum is for the email server software, not for java code development.
    A quick look at the error though indicates that you have the value "mail.yourisp.com" used somewhere in your code. This is NOT a valid mail-host address. You should be using something that matches your own ISP's mail-host.
    Regards,
    Shane.

  • How to handle the errors in transformations

    Hi
    I am using SOA, JDev 10.1.3.3.
    How to handle the exceptions in transformations.
    If any thing goes wrong in transformation then how to handle that situation.
    I am not getting any kind of instances like errored out..
    Please help me out
    Regards
    Pavankumar

    I think your issue is that your process is going into manual recovery.
    In the console click on the tab BPEL processes. There is a link on the left for manual recovery. Do you see your processes there?
    What happens if you put your transformation into a scope. The in that scope you have a catch All. In this catch All routine just do a terminate. This will error your process but you should see it appear in the console.
    cheers
    James

  • How to handle the error handling..its urgent

    hi guys...
    how to handle the Exception using jsf. for example...in java program we try to connect the server...if server not connect then the exception occur like java.net.ConnectException.. i have to handle exception using jsf and display related error page...plz give me ur valuable words..its need is very urgent..
    advance thanx and with regards
    DJ

    Hi,
    1. create a new error bundle (myErrMsg) // copy from javax/faces/Messages.properties in jsf-impl.jar
    2. declare this bundle in your faces-config
    <application>
    <message-bundle>bundle.MyErrMsg</message-bundle>
    <locale-config>
    <default-locale>en</default-locale>
    <supported-locale>de</supported-locale>
    <supported-locale>fr</supported-locale>
    </locale-config>
    </application>
    3. handle the Exception in your backing bean
    ResourceBundle bdle = ResourceBundle.getBundle("bundle.MyErrMsg",this.getLocale());
    context.addMessage(clientId, new FacesMessage(severity, bdle.getString(key), null));
    4. add the tag messages in your jsp
    <h:messages layout="table" errorClass="TextError" infoClass="Text"/>

  • Create wrapper to FM and handle the exceptions

    HI All
    I need to create wrapper FM to fm BDC_RECORD_TRANSACTION like zBDC_RECORD_TRANSACTION.
    the parameter should be the same and my question is how to handle the exceptions
    do i need to keep the exception in the wrapper fm exactly the same i.e.
    exactly the same signature for the exception and noting more or I need to add
    additional coding to handle it .
    CALL FUNCTION 'BDC_RECORD_TRANSACTION'
        EXPORTING
          tcode               = tcode
          authority_check     = 'X'
          OPTIONS             = ' '
          mode                = 'A'
          UPDATE              = 'A'
        TABLES
          dynprotab           = dynprotab
          messtab             = messtab
        EXCEPTIONS
          system_failure      = 1
          invalid_transaction = 2
          invalid_mode        = 3
          invalid_update      = 4
          OTHERS              = 5.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Regards
    Chris

    HI
    do you mean like this ?
    CALL FUNCTION 'BDC_RECORD_TRANSACTION'
        EXPORTING
          tcode               = tcode
          authority_check     = 'X'
          OPTIONS             = ' '
          mode                = 'A'
          UPDATE              = 'A'
        TABLES
          dynprotab           = dynprotab
          messtab             = messtab
        EXCEPTIONS
          system_failure      = 1
          invalid_transaction = 2
          invalid_mode        = 3
          invalid_update      = 4
          OTHERS              = 5.
      IF sy-subrc <> 0.
        CASE sy-subrc.
          WHEN 1.
            RAISE system_failure.
          WHEN 2.
            RAISE invalid_transaction.
          WHEN 3.
            RAISE invalid_mode.
          WHEN 4.
            RAISE invalid_update.
          WHEN OTHERS.
        ENDCASE.
    Thanks
    Chris
    Edited by: ChrisGW on Mar 16, 2011 11:40 AM

  • "Exception in "AWT-EventQueue-0""

    friends,
    i am getting an error when i want to handle an event(i.e. a button pressed). the error it throws is as follows
    Exception in "AWT-EventQueue-0" java.lang.NullPointerException
    at MyClass.actionPerformed(MyClass.java:12)
    actually i want to place some text in a textarea when a mouse is pressed. it is urgent. thanks for reply.
    regards
    haricse

    You're referencing a null on line 12 of MyClass.java
    Don't do that. (I.e. fix the null)

  • How to write the exceptions in function module

    dear all,
         how to write the exceptions in function modules with example.
    thanq
    jyothi

    Hi,
    Raising Exceptions
    There are two ABAP statements for raising exceptions. They can only be used in function modules:
    RAISE except.
    und
    MESSAGE.....RAISING except.
    The effect of these statements depends on whether the calling program handles the exception or not. The calling program handles an exception If the name of the except exception or OTHERS is specified after the EXCEPTION option of the CALL FUNCTION statement.
    If the calling program does not handle the exception
    · The RAISEstatement terminates the program and switches to debugging mode.
    · The MESSAGE..... RAISING statement displays the specified message. Processing is continued in relation to the message type.
    If the calling program handles the exception, both statements return control to the program. No values are transferred. The MESSAGE..... RAISING statement does not display a message. Instead, it fills the system fields sy-msgid, sy-msgty, sy-msgno , and SY-MSGV1 to SY-MSGV4.
    Source Code of READ_SPFLI_INTO_TABLE
    The entire source code of READ_SPFLI_INTO_TABLE looks like this:
    FUNCTION read_spfli_into_table.
    ""Local Interface:
    *" IMPORTING
    *" VALUE(ID) LIKE SPFLI-CARRID DEFAULT 'LH '
    *" EXPORTING
    *" VALUE(ITAB) TYPE SPFLI_TAB
    *" EXCEPTIONS
    *" NOT_FOUND
    SELECT * FROM spfli INTO TABLE itab WHERE carrid = id.
    IF sy-subrc NE 0.
    MESSAGE e007(at) RAISING not_found.
    ENDIF.
    ENDFUNCTION.
    The function module reads all of the data from the database table SPFLI where the key field CARRID is equal to the import parameter ID and places the entries that it finds into the internal table spfli_tab. If it cannot find any entries, the exception NOT_FOUND is triggered with MESSAGE ... RAISING. Otherwise, the table is passed to the caller as an exporting parameter.
    Calling READ_SPFLI_INTO_TABLE
    The following program calls the function module READ_SPFLI_INTO_TABLE:
    REPORT demo_mod_tech_fb_read_spfli.
    PARAMETERS carrier TYPE s_carr_id.
    DATA: jtab TYPE spfli_tab,
    wa LIKE LINE OF jtab.
    CALL FUNCTION 'READ_SPFLI_INTO_TABLE'
    EXPORTING
    id = carrier
    IMPORTING
    itab = jtab
    EXCEPTIONS
    not_found = 1
    OTHERS = 2.
    CASE sy-subrc.
    WHEN 1.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno.
    WHEN 2.
    MESSAGE e702(at).
    ENDCASE.
    LOOP AT jtab INTO wa.
    WRITE: / wa-carrid, wa-connid, wa-cityfrom, wa-cityto.
    ENDLOOP.
    The actual parameters carrier and jtab have the same data types as their corresponding interface parameters in the function module. The exception NOT_FOUND is handled in the program. It displays the same message that the function module would have displayed had it handled the error.
    Or
    just have to decide what exceptions u want and under what conditions.
    then declarethese exeptions under the exceptions tab.
    in the source code of ur function module.
    if
    like this u can code .
    now when u call the function module in tme mainprogram.
    if some error occurs and u have declared a exception for this then it will set sy-subrc = value u give inthe call of this fm.
    in the fm u can program these sy-subrc values and trigger the code for ur exception.
    Please reward if useful
    Regards,
    Ravi
    Edited by: Ravikanth Alapati on Mar 27, 2008 9:36 AM

  • How to handle system exception in Sync communication without BPM? Help!

    Hi Experts
       I have a Synchronous scenario in XI: webservice <------>RFC SAP R/3.
      Webservice is making a sync call to RFC FM in SAP R/3 system.
       I want to handle system exception when SAP R/3 is down and send an email alert.    
       Can I achieve this in graphical mapping without BPM? How? Kindly provide necessary steps/screenshots for the same.
       Are there any other alternatives for handling system exception apart from mapping and BPM?  
    Thanks
    Gopal

    Hi GopalKirshna,
          Yes,You can handle the Exception if at all you are using the RFC.You can achieve this without using BPM.
       Using Fault message you can catch the System Exception and even the primary role for Fault Message is to catch the RFC Exceptions.
       Please refer the Fault messages Notes to achieve this you will understand better.
    Hope I am clear.
    Please let me if you have any more queries regarding this..!
    Thanks and Rewards,
    Chandu.

  • How to handle an Exception in GP through webdunpro

    Hi,
    How to handle exception in WebDynpro GP callable objects.
    I created exception parameter in getdescription() method like
    IGPExceptionInfo processExc1 = technicalDescription.addProcessException("USER_NOT_FOUND");
      processExc1.setNameKey("USER_KEY");
      processExc1.setDescriptionKey("USER_DESCRIPTION_KEY");
      processExc1.setFatal(true);
    In my Process I have 2 levels, In block level i am able to see the above created exception using exception tab.
    I have created an action with same callable object mapped, this action is mapped to exception handler & selected an repeat option from dropdown.
    If any exception occurs in execute method(like UMException) how to call an  handler from coding. I tried this code to call a handler
    String localizedMessage =textAccessor.getText("USER_NOT_FOUND");
      wdThis.wdFireEventTechnicalException(new GPTechnicalCallableObjectException(logger,localizedMessage,e));
    this is not working...
    Can any one please bring me an Solution.
    Thanks in advance.
    Regards
    ThenMalar

    Hi Shikhil
    Thanks for your reply
    Please have a look below for exceptions which i am getting in GP and let me know how to handle these exceptions.
    1) "Activity could not be read"
    2) "Action has been stopped"
    3) error while processing the item can not be displayed
    if you give any idea/clue how to handle these exceptions then it would be great help to me
    Thanks
    Sunil

  • How to trap the exception in cursors

    Hi
    How to trap 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 some one help me please
    Edited by: user4587979 on Sep 27, 2010 3:46 AM

    user4587979 wrote:
    Hi
    How to trap 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 some one help me please
    Edited by: user4587979 on Sep 27, 2010 3:46 AMYou don't trap NO_DATA_FOUND in a cursor loop, as for others ... you trap and handle the ones you expect.
    NO_DATA_FOUND isn't a condition associated with the processing of a cursor loop.
    You have other options though, for example ...
    declare
       l_processed_something boolean default false;
    begin
       for x in cursor
       loop
          l_processed_something   := true;
          <more processing>
       end loop;
    end;
    /

Maybe you are looking for