Trap Exception and continue

Hi,
If the exception was trapped but would liek to continue to another stage anyways ( e.g Insert Statement or create index )
<pre>
sql_stmt1 :='DROP INDEX PRD_GLO_SDX';
EXECUTE IMMEDIATE sql_stmt1;
EXCEPTION
WHEN OTHERS THEN
raise_application_error(-20001,SQLERRM||' '||'PROBABLITY INDEX CANT BE DROPPED AS INDEX MAY NOT EXIST');
</pre>
Can anyone give hints on continuing eventhough there is an exception?
Cheers.

Write the part of code which even when fails should not disturb the parent code as a seperate block. Something like this.
begin -->Parent Block
  begin --> Child Block 1
    execute immediate <your statement>
  exception
    when <your exception> then
      <log the error> --> This very important. You should know that there was an error.
  end; --> Child Block Ends 1
  begin --> Child Block 2
    execute immediate <your statement>
  exception
    when <your exception> then
      <log the error> --> This very important. You should know that there was an error.
  end; --> Child Block Ends 2
end; --> Parent Block Ends

Similar Messages

  • Catch exception and continue the execution

    Hi Team,
    I require the action(such as insert/Update/Delete) for each row of table/table variable and also Error/Exception details as new column if occured any.
    Please refer below sample input and output.
    i was using merge, when exception occurs it fails to fit my requirement.
    My input data will be huge(such as 10k-15k), please suggest me optimized way to achieve this
    Kindly assist me.
    Thanks

    Hi,
    1. We don't know what make wrong and what exception occurs! We only have a nice story here :-)
    2. We don't have any information about your DDL and/or your source data an destination table, therefor we cant tell you  what is the best option.
    3. For 10-15K records doing a loop as suggested can be slow (for a 1000k it will be take for ever). It is highly faster most of the time for a big SET of data to use 3 queries (if MERGE is not an optioned), one for each operation (insert,update,delete),
     and to work with bulk insert! In this case the only heavy operation will be the fact that you need to use 3 time filtering but if your index fit the query this might be the best solution sometimes (again if merge is not an option). If the data come from
    external Data as CSV for example, then You can split the data into 3 sources before the queries, using 1 query or a small shell script prepering 3 sources. There can be several option fit your needs and uses which might fit better, but ont go to fast to work
    with looping record by record. try to thing of working with SETs of data.
    As mentioned, please post more information, In order to get the best solution for your specific case
    [Personal Site] [Blog] [Facebook]

  • How to catch date errors and continue processing in a PL/SQL procedure

    I'm updating a date field with dates constructed from day, month and year fields. The incoming data has many instances of day and month that are not valid dates, ex 11 31 2007. There is no 31st day in November.
    I would like to write a pl/sql script to scan the table containing these values and log the rows that produce conversion errors.
    I thought I could do this with exceptions but there are no exceptions that correspond to the ORA-01847 error for mismatched day and month.
    Here is what I tried (the print procedure is a local wrapper for DBMS_OUTPUT.put_line):
    PROCEDURE date_check IS
    start1 DATE ;
    BEGIN
    select to_date(nvl(yearcollected,'9999') ||'/'|| nvl(monthcollected,'01') ||'/'|| nvl(daycollected,'01'),'YYYY/MM/DD'))) into start1 from incoming_data where id=1 ;
         BEGIN
              update temp_test set test_date = start1 where id=1 ;
         EXCEPTION
              WHEN OTHERS THEN
              print('Date error message from exception block');
         END;
    print('Processing continues after handling date exception') ;
    END date_check ;
    Is there a way to catch this kind of error and continue processing after logging a message?
    -=beeky

    Hi, Beeky,
    There are lots of different error messages associated with bad dates. Rather than try to catch them all, I use a BEGIN ... EXCEPTION block that contains nothing but a TO_DATE call. This is one of the rare occassions when I think "EXCEPTION WHEN OTHERS" is okay,
    The following function comes from a package. If you want to make a stand-alone function, remember to say " *CREATE OR REPLACE* FUNCTION ...".
    --          **   t o _ d t   **
    --     to_dt attempts to convert in_txt (assumed to
    --          be in the format of in_fmt_txt) to a DATE.
    --     If the conversion works, to_dt returns the DATE.
    --     If the conversion fails for any reason, to_dt returns in_err_dt.
    FUNCTION     to_dt
    (     in_txt          IN     VARCHAR2                    -- to be converted
    ,     in_fmt_txt     IN     VARCHAR2     DEFAULT     'DD-MON-YYYY'     -- optional format
    ,     in_err_dt     IN     DATE          DEFAULT     NULL
    RETURN DATE
    DETERMINISTIC
    AS
    BEGIN
         -- Try to convert in_txt to a DATE.  If it works, fine.
         RETURN     TO_DATE (in_txt, in_fmt_txt);
    EXCEPTION     -- If TO_DATE caused an error, then this is not a valid DATE: return in_err_dt
         WHEN OTHERS
         THEN
              RETURN in_err_dt;
    END     to_dt
    ;

  • ** Is it possible to skip messages with error in BPM and continue next msg

    Hi Friends,
    I am doing File to File BPM scenario. My Source XML is like as below.
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:Employee xmlns:ns0="http://www.test.com/XITEST/FileToFile/BPM">
       <Details>
          <EmpCode>10010</EmpCode>
          <EmpName>Jeg</EmpName>
          <***>M</***>
          <BasicPay>5000</BasicPay>
       </Details>
       <Details>
          <EmpCode>10011</EmpCode>
          <EmpName>Praksh</EmpName>
          <***>M</***>
          <BasicPay>4500</BasicPay>
       </Details>
       <Details>
          <EmpCode>10012</EmpCode>
          <EmpName>Nithya</EmpName>
          <***>F</***>
          <BasicPay>4300</BasicPay>
       </Details>
       <Details>
          <EmpCode>10013</EmpCode>
          <EmpName>Sunil</EmpName>
          <***>F</***>
          <BasicPay>4800</BasicPay>
       </Details>
       <Details>
          <EmpCode>10014</EmpCode>
          <EmpName>Abdul</EmpName>
          <***>M</***>
          <BasicPay>4750</BasicPay>
       </Details>
       <Details>
          <EmpCode>10015</EmpCode>
          <EmpName>Sathya</EmpName>
          <***>F</***>
          <BasicPay>4250</BasicPay>
       </Details>
       <Details>
          <EmpCode>10016</EmpCode>
          <EmpName>Rams</EmpName>
          <***>M</***>
          <BasicPay>8000</BasicPay>
       </Details>
    </ns0:Employee>
    If you look at the above message, the 3rd & 6th employee are female. In the BPM design,  we use
    a) 'Transformation' step, to split the messages (1:n).
    b) Block Step (Mode : For Each) to process one by one message
    c) in the Container Step, thru XPath expression we created one variable and assign '***' to that variable
    d) In the Switch step we check whether variable is 'F' (Female). If it is there we insert control step to throw exception. (But, exception Branch is not added to catch the exception. The reason is that to restart the BPM)
    e) If the *** is 'M' we insert Send Step to send the employee to the output file.
    Note that if we insert exception handler branch, the BPM will tell this is completed. So, we are not able to restart those records (*** = 'F') after correct ***. Once the BPM is completed, that work item will not come in tcode 'Continue Process Following Error' option in tcode SXMB_MONI_BPE
    Requirement is whenever the BPM encounters *** = 'F', it  should throw an error and the same time BPM should not stop and continue with the next records.
    Friends, we tried all the ways thru 'Queue Assignment' property of the BPM and made settings thru tcode SWF_INB_CONF. But, we are not able to achive this requirmenent.
    'Restart possibilitye of the BPM for the error record and the same time should process the remaining correct records'. 
    Any idea friends, to solve this issue.
    Kindly Reply,
    Jeg P.

    Use one more Receiver Abstract interface for this and do the message and interface mapping .
    Collecting :
    If ur record is female (u r checking this in swich step) ,  pass tht record to intreface mapping (use one branch here to collect the message).
    Else you send that message to the target(else branch)
    After that use one block for collecting messages and throw the exception for each record......

  • OWB mappings to skip rows that are in error and continue processing

    OWB mappings to skip rows that are in error and continue processing.
    1) Enter a record into an error log
    2) Skip rows that are in error
    3) and continue processing
    Type of information could be needed in the error log:
    SY_LOG_ERROR_KEY
    ERROR_TIMESTAMP
    MAP_NAME
    SOURCE_RECORD
    ERROR_CODE
    ERROR_MESSAGE
    ERROR_NOTES
    Example:
    If the source table has five records, in that 3 records has some error.
    When I run the OWB mapping to load the source data to target table, OWB should skip the 3 record and load all the remaining record. This is our requirement.
    Another think I want to store the error record details in a error log table.
    Can u plz tell me whether it is possible in OWB. If not means please give some suggestion to do this.

    Hi,
    thanks for ur help, As is OWB version is 10.2.0 so for set based it is not working. with your idea i create a POST PROCESSING MAPPING. it is now working fine.
    Step 1:
    Create a table MAP_ERROR_LOG.
    Script:
    CREATE TABLE MAP_ERROR_LOG
    ERROR_SEQ NUMBER,
    MAPPING_NAME VARCHAR2(32 BYTE),
    TARGET_TABLE VARCHAR2(35 BYTE),
    TARGET_COLUMN VARCHAR2(35 BYTE),
    TARGET_VALUE VARCHAR2(100 BYTE),
    PRIMARY_TABLE VARCHAR2(100 BYTE),
    ERROR_ROWKEY NUMBER,
    ERROR_CODE VARCHAR2(12 BYTE),
    ERROR_MESSAGE VARCHAR2(2000 BYTE),
    ERROR_TIMESTAMP DATE
    TABLESPACE ODS_D1_AA
    PCTUSED 0
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 80K
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    BUFFER_POOL DEFAULT
    LOGGING
    NOCOMPRESS
    NOCACHE
    NOPARALLEL
    MONITORING;
    Step 2:
    Create a sequence MAP_ERROR_LOG_SEQ
    CREATE SEQUENCE MAP_ERROR_LOG_SEQ START WITH 1 INCREMENT BY 1
    Step 3:
    Create a procedure PROC_MAP_ERROR_LOG through OWB.
    In this i have used 3 cursor, first cursor is used to check the count of error messages for the corresponding table(WB_RT_ERROR_SOURCES).
    The second cursor is used to get the oracle error and the primary key values.
    The third cursor is used for get the ORACLE DBA errors such as "UNABLE TO EXTEND THE TABLESPACE" for this type errors.
    CREATE OR REPLACE PROCEDURE PROC_MAP_ERROR_LOG(MAP_ID VARCHAR2) IS
    --initialize variables here
    CURSOR C1 IS
    SELECT COUNT(RTA_IID) FROM OWBREPO.WB_RT_ERROR_SOURCES
    WHERE RTA_IID =( SELECT MAX(RTA_IID) FROM OWBREPO.WB_RT_AUDIT WHERE RTA_PRIMARY_TARGET ='"'||MAP_ID||'"');
    V_COUNT NUMBER;
    CURSOR C2 IS
    SELECT A.RTE_ROWKEY ERR_ROWKEY,SUBSTR(A.RTE_SQLERRM,1,INSTR(A.RTE_SQLERRM,':')-1) ERROR_CODE,
    SUBSTR(A.RTE_SQLERRM,INSTR(A.RTE_SQLERRM,':')+1) ERROR_MESSAGE,
    C.RTA_LOB_NAME MAPPING_NAME,SUBSTR(B.RTS_SOURCE_COLUMN,(INSTR(B.RTS_SOURCE_COLUMN,'.')+1)) TARGET_COLUMN,
    B.RTS_VALUE TARGET_VALUE,C.RTA_PRIMARY_SOURCE PRIMARY_SOURCE,C.RTA_PRIMARY_TARGET TARGET_TABLE,
    C.RTA_DATE ERROR_TIMESTAMP
    FROM OWBREPO.WB_RT_ERRORS A,OWBREPO.WB_RT_ERROR_SOURCES B, OWBREPO.WB_RT_AUDIT C
    WHERE C.RTA_IID = A.RTA_IID
    AND C.RTA_IID = B.RTA_IID
    AND A.RTA_IID = B.RTA_IID
    AND A.RTE_ROWKEY =B.RTE_ROWKEY
    --AND RTS_SEQ =1  
    AND B.RTS_SEQ IN (SELECT POSITION FROM ALL_CONS_COLUMNS A,ALL_CONSTRAINTS B
    WHERE A.TABLE_NAME = B.TABLE_NAME
    AND A.CONSTRAINT_NAME = B.CONSTRAINT_NAME
    AND A.TABLE_NAME =MAP_ID
    AND CONSTRAINT_TYPE ='P')
    AND A.RTA_IID =(
    SELECT MAX(RTA_IID) FROM OWBREPO.WB_RT_AUDIT WHERE RTA_PRIMARY_TARGET ='"'||MAP_ID||'"');
    CURSOR C3 IS
    SELECT A.RTE_ROWKEY ERR_ROWKEY,SUBSTR(A.RTE_SQLERRM,1,INSTR(A.RTE_SQLERRM,':')-1) ERROR_CODE,
    SUBSTR(A.RTE_SQLERRM,INSTR(A.RTE_SQLERRM,':')+1) ERROR_MESSAGE,
    C.RTA_LOB_NAME MAPPING_NAME,SUBSTR(B.RTS_SOURCE_COLUMN,(INSTR(B.RTS_SOURCE_COLUMN,'.')+1)) TARGET_COLUMN,
    B.RTS_VALUE TARGET_VALUE,C.RTA_PRIMARY_SOURCE PRIMARY_SOURCE,C.RTA_PRIMARY_TARGET TARGET_TABLE,
    C.RTA_DATE ERROR_TIMESTAMP
    FROM OWBREPO.WB_RT_ERRORS A,OWBREPO.WB_RT_ERROR_SOURCES B, OWBREPO.WB_RT_AUDIT C
    WHERE C.RTA_IID = A.RTA_IID
    AND A.RTA_IID = B.RTA_IID (+)
    AND A.RTE_ROWKEY =B.RTE_ROWKEY (+)
    AND A.RTA_IID =(
    SELECT MAX(RTA_IID) FROM OWBREPO.WB_RT_AUDIT WHERE RTA_PRIMARY_TARGET ='"'||MAP_ID||'"');
    -- main body
    BEGIN
    DELETE ED_ODS.MAP_ERROR_LOG WHERE TARGET_TABLE ='"'||MAP_ID||'"';
    COMMIT;
    OPEN C1;
    FETCH C1 INTO V_COUNT;
    IF V_COUNT >0 THEN
    FOR REC IN C2
    LOOP
    INSERT INTO ED_ODS.MAP_ERROR_LOG
    (Error_seq ,
    Mapping_name,
    Target_table,
    Target_column ,
    Target_value ,
    Primary_table ,
    Error_rowkey ,
    Error_code ,
    Error_message ,
    Error_timestamp)
    VALUES(
    ED_ODS.MAP_ERROR_LOG_SEQ.NEXTVAL,
    REC.MAPPING_NAME,
    REC.TARGET_TABLE,
    REC.TARGET_COLUMN,
    REC.TARGET_VALUE,
    REC.PRIMARY_SOURCE,
    REC.ERR_ROWKEY,
    REC.ERROR_CODE,
    REC.ERROR_MESSAGE,
    REC.ERROR_TIMESTAMP);
    END LOOP;
    ELSE
    FOR REC IN C3
    LOOP
    INSERT INTO ED_ODS.MAP_ERROR_LOG
    (Error_seq ,
    Mapping_name,
    Target_table,
    Target_column ,
    Target_value ,
    Primary_table ,
    Error_rowkey ,
    Error_code ,
    Error_message ,
    Error_timestamp)
    VALUES(
    ED_ODS.MAP_ERROR_LOG_SEQ.NEXTVAL,
    REC.MAPPING_NAME,
    REC.TARGET_TABLE,
    REC.TARGET_COLUMN,
    REC.TARGET_VALUE,
    REC.PRIMARY_SOURCE,
    REC.ERR_ROWKEY,
    REC.ERROR_CODE,
    REC.ERROR_MESSAGE,
    REC.ERROR_TIMESTAMP);
    END LOOP;
    END IF;
    CLOSE C1;
    COMMIT;
    -- NULL; -- allow compilation
    EXCEPTION
    WHEN OTHERS THEN
    NULL; -- enter any exception code here
    END;

  • How to interrupt an funtion call and continue the followed code?

    for example, the code:
    public class A{
    public static void main(String[] args){
    int i = 0;
    method1();
    system.out.println("exit");
    public void method1(){
    int j = 0;
    while(true){
    j +=1;
    there is a error in method1(), so the call the method1( ) in main() will make an error.
    how can i interrupt this funtion call and continue the followed code?

    in actually, I can not control the method1(), that's
    an remote object function.
    So I can not add exception in methoes().Then in your main method catch whatever "Error" your method1 is throwing.

  • HT4847 i want to keep and continue the amount of iCloud storage that I currently have

    i want to keep and continue the amount of iCloud storage that I currently have.  How do I extend my current iCloud service beyond the expiration date?

    Are you an ex-MobileMe subscriber who has the complimentary extra storage? If so this will downgrade to the free storage level at the end of next September, and if you want to keep the storage you will need to cancel the downgrade and pay for the additional storage. Note that if you purchase additional storage before next September it will cancel the complimentary storage immediately. Please see
    http://support.apple.com/kb/HT5527
    If you are not an ex-MobileMe subscriber then as said above you need do nothing except make sure you have a valid credit card registered.

  • HT5622 When my daughter got her first iphone we set it up with my email address, she now has her own email & new iphone.  I want to use my email address for my icloud, can I delete the content  from the icloud account and continue to use my email?

    When my daughter got her first iphone we set it up with my email address, she now has her own email & new iphone.  I want to use my email address for my icloud, can I delete the content from the icloud account and continue to use my email?

    Yes, but be sure she is on a separate iCloud account with a separate ID before deleting anything.  Be sure there is nothing that you want to keep on your device too.  When you delete the data from iCloud it will be deleted from all devices signed into the account.  Then you can delete the data from the existing account by doing the following:
    To delete the contacts, go to iCloud.com from your computer, log into your iCloud account and open Contacts, click on All Contacts on the left, to the right click on any single contact to select it, click on the Actions (gear shaped) icon at the bottom left and choose Select All, then press the Delete key on your keyboard.
    For Calendars, open the calendar on icloud.com, click Edit on the bottom left, then tap the minus sign to the right of each calendar to delete it.
    For Notes, open notes on icloud.com, click on each note on the left, then click Delete at the top to delete it.
    For Reminders, open reminders on icloud.com, click on each reminder and press your Delete key to delete it.
    For Mail, open your mail on icloud.com, click each folder on the left (such as your inbox), click on a single message to the right, press Control-A on your keyboard to select them all, then press your Delete key.  Repeat this for each of your mail folders except Trash.  When finished, click on the actions (gear-shaped) icon on the bottom left and select Empty Trash.
    If you also want to delete your iCloud backups you can go to Settings>iCloud>Storage & Backup>Manage Storage on your device, tap the name of your device under Backups, then tap Delete Backup.

  • Handle exception and finish procedure

    Hi everybody,
    I have a Store Procedure and I have some exceptions handling but when my procedure catches an exception, it finish abruptly. Is there a way to catch the exceptions and let the procedure continue with the next part until the very end of the procedure? (if there are many exceptions handle them but never finish the procedure abruptly)
    Thanks for any advice you can give,
    Federico

    This is the forum for SQL Developer (Not for general SQL/PLSQL questions), your question would be better asked in the SQL and PL/SQL forum.
    You may be catching the exceptions, but you are not handling them if your procedure terminates.
    begin
      -- some query
    exception
    -- handle no_data_found
    when no_data_found then
        nodata:=true;
    -- don't handle anything else
       when others then
         raise;
    end;
    -- more code

  • I just want to keep CSx updated and continue to use it like I have been.

    I'm an individual.. One computer!, no team or bank of computers... Just me..
    I don't need a cloud! I don't want a cloud!
    I just want to keep CSx updated. and continue to use it like I have been.
    Cost me about $600 every other year to keep this updated.
    I can afford $600/every other year.
    What do I need to do to keep using The Design Premium CSx ??

    Short answer:   You are [or eventually will be] outdated and out of luck.
    I've been a master collection user since it's been availaboe, but I've been struggling with this and other questions, and have come to the conclusion that I need to be proactive in looking for alternatives, so when the day comes that CS6 stops working on new hardware, I'll have options.
    My biggest concern is that with the current CC model, if a user decides to stop, or can't afford, their subscription fee, thirty days later they loose access to ALL THEIR CREATIVE WORK-- without monthly activation,  all the CC software STOPS WORKING!
    Moreover, after everyone is on the CC hook, what is to stop Adobe from charging $100 per month, or $300....  As a huge company driven by investors and quarterly profits they will charge whatever the market will bear.  Many will be held hostage to the subscription fee, no matter how high it goes, because they won't be able to afford to loose access their creative work.  So... going forward the market will probably bear a lot more than $49 per month.
    Then, if this wasn't enough risk, there is also the dependence on the web and Adobe's IT infrastructure to keep the software "activated".  I know it is probably extremely unlikely, but what if they suffer a cyber-attack like many other large and theoretically "secure" companies?  What kind of havoc could an attacker wreak with the creative community if suddenly all our software stopped working?  You may laugh, but I just read an article today on cNet Security about how Twitter's domain registration was hacked by SEA-- at least for a brief time, SEA was the admin for the Twitter domain records.
    Since hearing Adobe's plans, I realised that over the years, with the exception of 3D, I've gravitated to Adobe for all my creative work-- they really do make great software.  Even though this represents a huge investment in time and "learning curve", I've started to seriously evaluate alternatives.  When the day comes that CS6 is no longer working on new hardware, I hopefully will already be using other brands.
    My current thinking:  If Apple makes FCP 11 a professional tool again, that would be my first choice for video.  If they don't, I've been taking a hard look at Sony Vegas-- or there is always Avid.  For compositing, while I really know and love After Effects, I have a copy of Eyeon's Digital Fusion that came free with Lightwave3D that I've never even installed.  It is now out of the closet and sitting on my desk, waiting until I have a few minutes to install it to give it a try.  For photo editing and vector graphics, I've been looking at the Corel suite-- I haven't used Corel in years, as it always seemed "clunky" compared to Illustrator,  but it is a viable alternative, and used and loved by many.  Photoshop is an industry standard and I've used it for fifteen years, but I also have both Gimp and Cinepaint on Mac, and use them frequently already.  They aren't as capable or as slick as Photoshop, but they do everything I need, so photo editing is covered.  As far as web tools, Dreamweaver is nice, but web development can be done with any editor.  Flash (and all browser plugin technology) is being supplanted by HTML5 and Javascript, so loosing Flash, going forward, is no great loss.  I haven't used it in over a year anyway, but f I really need 2D animation there is always (gasp) Silverlight, and maybe also other tools that I'm currently unaware of.  InDesign isn't a concern for me as I almost never do print.
    So bottom line for me:   If Adobe works out a compromise where the software keeps working even if the subscription lapses, then it would be a different ballgame for me. I'd even be willing to agree to pay two or three year contract before the perpetual license kicked in.  However, as it stands, the CC subscription (and potentially vanishing software) represents a level of trust in Adobe that I'm not prepared to give.

  • Example of WAIT and CONTINUE using checkBox and thread and getTreeLock()

    I had so much trouble with this that I descided to
    post if incase it helps someone else
    // Swing Applet example of WAIT and CONTINUE using checkBox and thread and getTreeLock()
    // Runs form dos window
    // When START button is pressed program increments x and displys it as a JLabel
    // When checkBox WAIT is ticked program waits.
    // When checkBox WAIT is unticked program continues.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.*;
    import java.io.*;
    public class Wc extends JApplet {
    Display canvas;//drawing surface is displayed.
    Box buttonPanel;
    Box msgArea;
    public static JButton button[] = new JButton [2];
    public static JCheckBox checkBox[] = new JCheckBox[2];
    public static JLabel msg[] = new JLabel [2];
    String[] buttonDesc ={"Start","Quit"};
    public static final int buttonStart = 0;
    public static final int buttonQuit = 1;
    String[] checkBoxDesc ={"Wait"};     
    public static final int checkBoxWait = 0;
    public boolean wait;
    public Graphics g;
    //================================================================
    public static void main(String[] args){
    Frame f = new Frame();
    JApplet a = new Wc();
    f.add(a, "Center"); // Add applet to window
    a.init(); // Initialize the applet
    f.setSize(300,100); // Set the size of the window
    f.show(); // Make the window visible
    f.addWindowListener(
    new WindowAdapter(){
    public void windowClosing(WindowEvent e){System.exit(0);}
    }// end main
    //===================================================
    public void init() {
    canvas = new Display();
    setBackground(Color.black);
    getContentPane().setLayout(new BorderLayout(3,3));
    getContentPane().add(canvas, BorderLayout.CENTER);
    buttonPanel = Box.createHorizontalBox();
    getContentPane().add(buttonPanel, BorderLayout.NORTH);
    int sbZ;
    // add button
    button[0] = new JButton(buttonDesc[0]);
    button[0].addActionListener(canvas);
    buttonPanel.add(button[0]);
    button[1] = new JButton(buttonDesc[1]);
    button[1].addActionListener(canvas);
    buttonPanel.add(button[1]);
    // add checkBox
    sbZ=0;
    checkBox[sbZ]=new JCheckBox(checkBoxDesc[sbZ]);
    checkBox[sbZ].setBackground(Color.white);
    checkBox[sbZ].setOpaque(true);
    checkBox[sbZ].addActionListener(canvas);
    buttonPanel.add(checkBox[sbZ]);
    msgArea = Box.createVerticalBox(); // add message
    sbZ=0;
    msg[sbZ]=new JLabel("1",JLabel.LEFT);
    msg[sbZ].setOpaque(true);
    msg[sbZ].setBackground(Color.black);
    msg[sbZ].setForeground(Color.red);
    msgArea.add(msg[sbZ]);
    getContentPane().add(msgArea, BorderLayout.SOUTH);
    } // end init();
    //===================================================
    public void stop(){canvas.stopRunning();}
    //===================================================
    // The following nested class represents the drawing surface
    // of the applet and also does all the work.
    class Display extends JPanel implements ActionListener, Runnable {
    Image OSI;
    Graphics OSG; // A graphics context for drawing on OSI.
    Thread runner; // A thread to do the computation.
    boolean running; // Set to true when the thread is running.
    public void paintComponent(Graphics g) {
    if (OSI == null) {
    g.setColor(Color.black);
    g.fillRect(0,0,getWidth(),getHeight());
    else {g.drawImage(OSI,0,0,null);}
    }//paintComponent
    public void actionPerformed(ActionEvent evt) {
    String command = evt.getActionCommand();
    if (command.equals(buttonDesc[buttonStart])) {
    startRunning();
    if (command.equals(buttonDesc[buttonQuit])) {
    stopRunning();
    if (command.equals(checkBoxDesc[checkBoxWait])){
    System.out.println("cb");
    if (checkBox[checkBoxWait].isSelected() ) {
    wait = true;
    System.out.println("cb selected twait "+wait);
    return;
    wait = false;
    synchronized(getTreeLock()) {getTreeLock().notifyAll();}
    System.out.println("cb selected fwait "+wait);
    } // end command.equal cb wait
    } //end action performed
    // A method that starts the thread unless it is already running.
    void startRunning() {
    if (running)return;
    // Create a thread that will execute run() in this Display class.
    runner = new Thread(this);
    running = true;
    runner.start();
    } //end startRunning
    void stopRunning() {running = false;System.exit(0);}
    public void run() {
    button[buttonStart].setEnabled(false);
    int x;
    x=1;
    while(x>0 && running){
    x = x + 1;
    msg[0].setText(""+x);
    try{SwingUtilities.invokeAndWait(painter);}catch(Exception e){}
    //importand dont put this in actionPerformed
    if (wait) {
    System.out.println("run "+wait);
    synchronized(getTreeLock()) {
    while(wait) {
    System.out.println("while "+wait);
    try {getTreeLock().wait();} catch(Exception e){break;}
    } //end while(wait)
    } // end sync
    } // end if(wait)
    } // endwhile(x>0)
    stopRunning();
    } // end run()
    Runnable painter = new Runnable() {
    public void run() {
    Dimension dim = msg[0].getSize();
    msg[0].paintImmediately(0,0,dim.width,dim.height);
    Thread.yield();
    }//end run in painter
    } ; //end painter
    } //end nested class Display
    } //end class Wc

    I just encountered a similar issue.  I bought a new iPhone5s and sent my iPhone4s for recycling as it was in great shape, no scratches, no breaks, perfect condition.  I expected $200 and received an email that I would only receive $24.12.  The explanation was as follows:  Phone does not power on - Power Supply Error.   Attempts to discuss don't seem to get past a customer service rep that can only "escalate" my concern.  They said I would receive a response, but by email.  After 4 days no response.  There is something seriously wrong with the technical ability of those in the recycling center.

  • Pause and Continue Cycle

    Greetings,
    I want to be able to pause a cycle and continue later.
    For example, I have a program that does calculations for ever and ever and keeps printing stuff in the console.
    I want to press a Key, pause the cycle, and then be able to type the program commands on the console.
    If I type the command "continue", the cycle continues the calculations.
    Here is the sample code.
    Code:
    public class Testes {
    public static void main(String[] args) throws Exception {
    int i = 0;
    boolean run = true;
    BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
    String inputString;
    while(true){
         if(run){ 
    //calculation sequence
              i++;
              System.out.println(i);
              //???something so that if some key was pressed, "run" becomes false
         else { 
              while(true){
              inputString = input.readLine();
              if(inputString.equals("run")) {run = true; break;}
    I would like that the solution satisfy 3 conditions:
    1- Very eficient, that is, the calculations will take days so the solution can not make the program "slower" on normal operation (performing calculations) (low overhead)
    2- When user press pause, the program only stops after the last instruction of the calculation cycle. That is, all paused states are coherent/atomic. All calculations of that interaction were made. (I guess this doen't allow thread-based solutions, which I am glad if I can avoid)
    3- THe simpler the better. For example, after calculations can't i check if user pressed any key, but if not don't wait until it does? this would be enought to solve this, but all java input functions wait for users to type.
    Thanks beforehand.
    Greetings

    If you're just looking for enter, you should be able to use System.in.available() and then System.in.read() if it's non-zero. The problem, I believe, is that some systems don't push any input until you press enter.
    You could also do it with a GUI and KeyListener.
    However, I don't know what kind of performance impact the available()/read() loop will have. Your best bet is probably to have a simple thread situation with one that's just blocking on any keyboard input and the other that's running the calculation. Then again, if your calculation is taking days, I don't know whether the performance impact of those extra loops will make a difference. Test it, and if you can avoid the threads, go for it. I put this example together as an experiment (leaving out the non-threading code):
    public class Calculation extends Thread {
        public static void main(String[] args) throws IOException {
            Calculation calc = new Calculation();
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            // Start calculating on the other thread
            calc.start();
            // Loop waiting for keyboard until calculation finishes.
            // readLine() is blocking, so this only loops after input is received.
            while(!calc.isCompleted()) {
                reader.readLine();
                synchronized(calc) {
                     if(calc.isPaused()) {
                         // If it's already paused, unpause and clear the wait().
                         calc.setPaused(false);
                         calc.notify();
                     } else {
                         calc.setPaused(true);
        public void run() {
            setCompleted(false);
            setPaused(false);
            try {
                // Loop until completion -- this keeps it going after unpausing
                while (!isCompleted()) {
                    // Check for pause and completion before each step. This keeps it atomic.
                    while (!isPaused() && !isCompleted()) {
                        runCalculation();
                    // All we know here is that it's either paused or completed.
                    // If it's completed, keep going to finish the loop.
                    // Otherwise, wait() until notified.
                    while (isPaused()) {
                        synchronized (this) {
                            this.wait();
            } catch (InterruptedException e) {
                Thread.currentThread().interrupt();
    }This probably isn't the cleanest code (suggestions welcome) but it does work. If I was doing this for real, I'd break up some of these nested blocks, for example. Only problem is that it requires you to hit enter at the end after it completes, too.

  • Place Call and continue with remaining script steps - is it possible?

    We recently picked up IPCelerate which has the ability to send a Text display or Text-to-Speech message to a group of phones simply by dialing a configured directory number.  We would like to text our call center agents with this application when a caller has been waiting for X number of loops.
    Attempting to use 'Place Call' to initiate this text page works, however, the script terminates immediately after the call is placed and we would like to continue on with the remainder of our script.  In this case, on Success go back to the top of the loop.   
    I have also tried to use Call Subflow instead, thinking an executed sub-routine placing the call would return to the original script and continue on, but it didn't.  In both cases, the system comes back and states " I'm sorry, we're currently experiencing system problems and are unable to process your call.  Please try again later."
    If there's a way to get this to work via Place Call or another process to accomplish the same result, that would be fantastic.  I appreciate any feedback.
    We're using UCCx Express 5.0 (2.064) with premium type licensing.

    Hello,
    I did get to an answer similar to what r.stockton did to solve the issue, but I left Exception (ContactInactiveException) Goto in ours to isolate exceptions because we have multiple contacts within our script.  Turns out that this particular exception was thrown by the PlaceCall step ending abruptly by our paging system answering and hanging up the call quickly.  MIVR logs showed that it didn't bomb as immediately as when the debugs showed it crashing - it actually went into a loop over and over with the Trigger contact before failing.
    We had some help from TAC on this, but below is what we did to keep some error checking and notification we use available to us.  We are running a check to make sure the Call Trigger (original call) is still active.
    placecallContact = Place Call (to Number)
    on Exception (ContactInactiveException) Goto
    label:
    CallActive = Get Contact Info (--Trigering Contact--, Active)
    If (CallActive) Then
    - True branch continues with script
    - False Branch terminates call
    If this takes the false branch, it means the trigger contact is not active, and has abandoned the call or been transferred elsewhere.  Placed an End step here to prevent any loops.
    If this takes the true branch, it means the triggering contact is actually still active. In our scenario, CallActive (boolean variable) is verified true and continues with the script without going into the loop of death.
    I hope this helps!

  • Trapping exceptions

    Hi,
    I'm trying to trap an exception in a member procedure, but it doesn't seem to recognise the exception.
    The code is below, would someone be able to tell me where i'm going wrong?
    create or replace type body assign_objtypA as
    member procedure assign_Offer(id number, OfferNumber number) is
    cust_name varchar2(30);
    award_name varchar2(40);
    ---example of trapping exceptions for invalid id
    invalid_id EXCEPTION;
    begin
    select Name into cust_name
    from customer_objtabA
    where CustID = id;
    if sql%notfound then
    raise invalid_id;
    end if;
    exception
    when invalid_id
    then
    DBMS_OUTPUT.PUT_LINE('The customer id is invalid');
    end assign_Offer;
    end;
    show errors;
    When i replace it with just a normal exception like
    when no_data_found then
    Dbms_output("id invalid);
    this works fine.
    Can anyone see where i'm going wrong?
    Cheers,

    Your code is an example of an unhandled exception. If the select statement fails to find any rows, a NO_DATA_FOUND exception is raised. This will immediately go to the relevant exception handling portion of code in your procedure (i.e. the "if sql%notfound" statement will not be executed). In this case, you do not handle NO_DATA_FOUND, so the exception will be escalated to the calling code.
    Just trap NO_DATA_FOUND.
    If you want to raise your own custom exception, simply trap NO_DATA_FOUND and then raise your own exception (you might want to use RAISE_APPLICATION_ERROR - see : http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96624/07_errs.htm#943)

  • While, try/catch and continue

    Hello,
    i've got a while-loop which executes some statements. some of them are within a try-catch block.
    imagine like this:
    while (channelsIT.hasNext()) {
       RSSChannel channel = channelsIT.next();
       RSSChannelReader reader = new RSSChannelReader(channel.getStrRSSUrl());
       try {
          reader.connect();
       } catch (Exception e) {
          log.error("Fehler beim Lesen eines RSS-Channels", e);
          continue;
       Collection items = reader.getChannelItems();
    }As you may see, it makes no sense in this case to continue the loop after reader.connect() failed. for that, I tried to use the continue statement, but the code interrupts after the logging and the application failes.
    the workaround is to put all the code of the while loop into the try-block, but for that seems to be a bad solution.
    while (channelsIT.hasNext()) {
       RSSChannel channel = channelsIT.next();
       RSSChannelReader reader = new RSSChannelReader(channel.getStrRSSUrl());
       try {
          reader.connect();               
          Collection items = reader.getChannelItems();
       } catch (Exception e) {
          log.error("Fehler beim Lesen eines RSS-Channels", e);
          continue;
    }so why does my first code not work properly?
    Thank you for any suggestions.

    Then I misunderstood you.
    public class Test {
      public static void main(String args[]) {
        int i = -1;
        while (i < 10) {
          int j = i % 2;
          i++;
          try {
            System.out.print(i / j);
          } catch (Exception e) {
            System.out.println(i + " skipped");
            continue;
          System.out.println(" - after");
    }This writes "after" if there's no exception and skipped if there is one:
    0 - after
    1 skipped
    2 - after
    3 skipped
    4 - after
    5 skipped
    6 - after
    7 skipped
    8 - after
    9 skipped
    10 - after
    So it behaves exactly as you want it to, and so should your first code. Is it the exact code you posted, including "catch (Exception"?

Maybe you are looking for

  • Can't install Extension manager 6.0.4 under Mac OS 10.8.2 ?

    Hello, So I'm french. And I can't install Extension Manager under Mac OS 10.8.2 ? Donc , je ne peux installer Extension Manager sous Mac OS 10.8.2 ? The error code is Echec de l'installation. Code d'erreur : U44M1P7 Merci pour toute aide. Thank you f

  • Attempting to download Adobe Flash Player 11.3 to use the Picaboo Photo website and it will not download. Help please?? :)

    In an attempt to create a photobook with a Groupon I purchased, I need to have Adobe Flash Player 11.3. When I click 'Get Started' on the Picaboo website then 'Yes' to 'This content requires Adobe Flash Player 11.3. Would you like to download?' it th

  • Duplicate rows in 5 table

    I have five tables(A,B,C,D,E), and I am trying to check for duplicate rows in all the tables, I tried using inner join, but the first three join did not return any table. is there another way.the tables only have two columns , the email(different val

  • Smoothing video in CS6

    hi I need an urgent help, I have imported an FLV video in flash pro cs6 and now trying to add a script to make it look smooth when resized. I googled for days and couldn't found a straight answer, how can i use this code to smooth the video when resi

  • No apps will run on my iPad except built-in ones

    I just was using my iPad this morning... checked news, a few other things. All was fine. I just picked it up and tried to run 1password and it quickly blinks then sends me back to the main screen. I now try run any 3rd party apps and they all do the