Handling errors inside Procedure
Hi..
I have created the following procedure.. and the procedure work out well when there are no duplicates in the table.
If the duplicate arises the errors messages is also displayed..
CREATE OR REPLACE PROCEDURE P_MC_IPS (lDate IN
DATE) IS
PROJ_INV VARCHAR2(50);
MAC_IP VARCHAR2(100);
CURSOR M_IP IS
SELECT DISTINCT A.TITLE TITLE,B.MACHINE_IP MACHINE_IP FROM JOB_LIST A,TD B WHERE A.JOBNUMBER = B.JOBNO AND B.ACT_DATE = TO_CHAR(ldate,'DD-MON-YYYY');
BEGIN
OPEN M_IP;
LOOP
FETCH M_IP INTO PROJ_INV,MAC_IP;
EXIT WHEN M_IP%NOTFOUND;
INSERT INTO NET_ADDRESS(P_INV,MACHINE_IPS) VALUES(PROJ_INV,MAC_IP);
COMMIT;
END LOOP;
CLOSE M_IP;
EXCEPTION
WHEN DUP_VAL_ON_INDEX THEN
DBMS_OUTPUT.PUT_LINE('DUPLICATE RECORDS EXISTS');
END P_MC_IPS;
The Problem here is I need to insert other values except the datas that has duplicate index.
I need to insert the data except the duplicate record when i run the procedure again.
I need to use the exception type "UP_VAL_ON_INDEX " to handle the exception. Can anyone help out regd. this
Kindly help me on this issue.
Thanks
gayathri
Use an inner block to handle the exception.
CREATE OR REPLACE PROCEDURE p_mc_ips
(lDate IN DATE)
IS
BEGIN
FOR lrec IN (SELECT DISTINCT a.title title,b.machine_ip machine_ip
FROM job_list a,td b
WHERE a.jobnumber = b.jobno
AND b.act_date = TO_CHAR(ldate,'DD-MON-YYYY'))
LOOP
BEGIN
INSERT INTO net_address(p_inv,machine_ips)
VALUES(lrec.title, lrec.machine_ip);
EXCEPTION
WHEN DUP_VAL_ON_INDEX THEN
DBMS_OUTPUT.PUT_LINE('DUPLICATE RECORDS EXISTS');
END;
END LOOP;
COMMIT;
END p_mc_ips;You'll have noticed that I've streamlined your code a bit. We'll save using FORALL and anti-joins for another day ;)
Cheers, APC
Similar Messages
-
Is including an error handler in every procedure OK?
Hello,
I have read a lot of articles about error handling on the internet but could not find advice on whether it is good/acceptable practice to put a handler in every procedure. My goal
when debugging is to break on every error, so that the relevant variables are still in scope, and I can view them and react to the error. Is there a VS setting for this, or do I need to achieve this via error handling?
In VB6 I think that there used to be a “Break on all errors” option.
Currently, many procedures in my code do not have error handlers. When an error is encountered in a procedure that does not have an error handler, I believe that control is passed back down the stack to the first procedure that has a Catch.
This makes it hard to debug, because the error variables that I need to review are out of scope.
Therefore, if one is not worried about performance considerations, is it reasonable/best practice to include an error handler in every procedure where there might conceivably be an error?
Also, how will the above approaches affect runtime behaviour?
Many thanks.
Keith
R K HowardHi Keith,
First, just to be clear, I am going to assume that by error handling we are talking about Try-Catch blocks in code. As Acamar said, if you write a block of code that has the potential to fail, and you have a plan for doing something when that failure
occurs, then definitely wrap the code block in a Try-Catch.
As for what happens in the debugger when an error occurs, it depends on the context of the error and the assembly in which it occurred. If you are still on the UI thread and the error occurred in your code or a base class library, then execution
will stop on the line of code that caused the error - with or without a Try-Catch. If however the error occurred in another thread, asynchronously, or within an assembly for which you do not have source code (or in unmanaged code), then the debugger
will break at the lowest spot in the stack where managed code with known source was executed, or nowhere (no source available) if there is no source code or you broke in unmanaged code. In these cases, adding a Try-Catch might let you break closer to
the exception because there is managed code executed to create the Try statement - but it still doesn't let you break
at the actual exception because there's still either no source code or the error is unmanaged.
So I guess the answer is two-part: don't be afraid to use Try-Catch anywhere that it makes sense, and wait for the improved debugging experience in the next version of Visual Studio (they're improving the ability to debug with secondary threads and async
code execution).
Reed Kimble - "When you do things right, people won't be sure you've done anything at all" -
Handling exceptions inside a Presentation
Hi people, I have a problem handling exceptions inside a Presentation that it is inside an screenflow (that it is inside a Global Creation Activity). This it is in some way related to this other thread: Managing transactions with DynamicSQL
I have an Interactive Activity that renders an Object BPM's Presentation. This Presentation has dependent combos (i.e.: Country, State, City).
Although I can add an exception transition to the Interactive Activity, if the BP-Method that fills the other combo fails, this exception transition it is not executed. Instead, it shows a screen with the stack trace.
The solution I've found: catch the exception inside the BP-Method, and use this.showError let the user know that something went wrong.
This solves my problem, but I'd like to know why ALBPM let me put an exception transition from an Interactive Activity? I mean, in which cases this transition could be executed
Thanks in advance!This does not solve my problem, but I think that it would be a better design idea not to allow presentations to call server-side BP-Methods directly. Instead it should call a client-side BP-Method and from this method call the one in the server.
This should improve the way we can handle an error that occurs on a server-side BP-Method
It's for sure a "best practice", but I think it would be better if the tool help us to implemented this way
What do you think? -
Dynamic Sql no execute inside procedure
Hi
There are a new table, I give permission for select, update, inser and delete, when I executed query select work fine, but when This query is executed inside procedure with dynamic sql return error: ORA-01031 Insufficient Prvileges
I try to test out procedure and work fine , see below
declare
CCURSOR SYS_REFCURSOR;
RCURSOR TRITON.TTDSLS992901%ROWTYPE;
V_SQL VARCHAR2(2000);
begin
V_SQL :='SELECT * FROM TRITON.TTDSLS992'|| '901' || CHR(10);
V_SQL := V_SQL || ' WHERE T$CONO$O = 410705'|| CHR(10);
V_SQL := V_SQL || ' AND T$PONO$O = 10'|| CHR(10);
V_SQL := V_SQL || ' AND T$COND$O = 0'|| CHR(10);
V_SQL := V_SQL ||'AND T$ETPA$O = 1 '|| CHR(10);
V_SQL := V_SQL || ' AND ROWNUM = 1'|| CHR(10);
V_SQL := V_SQL || ' ORDER BY T$CONO$O, T$PONO$O, T$COND$O DESC';
OPEN CCURSOR FOR V_SQL;
FETCH CCURSOR INTO RCURSOR;
IF CCURSOR%FOUND THEN
NULL;
ELSE
NULL;
END IF;
CLOSE CCURSOR;
end;the Code 901 is not constant, change when Company change
Why return error permission inside procedure ?Hardcode the value to '901' & check TRITON.TTDSLS992901 has execute permission to schema where you want to call this
TRITON.TTDSLS992'|| '901' ~Lokanath -
How to handle errors in data templates
Hi
What is the recommended way to handle errors for example if one of your SQL statement in a data template returned no data how and where would you be able to create an error message for the user to find and read.
Thanks,
MarkThe closest I have come to doing this is to put conditional statements into the format template. If a value matches an expected (ex. is null) you can return a message (in the report) via the format template (ex. "No Data Found").
I am not sure this really answers your question as this is in the format template, but I generally view them as a matched pair that work together. I try to stick with data extraction in the data define, and do all my conditional stuff in the format templates.
Scott -
Okay, I will have a window open with 4 tabs open. At first, everything is fine, but after a day or so, a message will pop up on screen saying "'''Exc in ev handl: Error: Bad NPObject as private data!'''" and after you close it out, the tab you were on will close and reopen in it's own window. I then have to shut down all both old and new windows and open a new window with my original 4 tabs again. It will work fine until a few days pass and it starts over again.
This issue can be caused by the McAfee Site Advisor extension
*https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes
Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
*Don't make any changes on the Safe mode start window.
*https://support.mozilla.com/kb/Safe+Mode -
While opening the iTune Store i receive the following error, "The procedure entry point ADAdPolicyEngine_DidEnterSation could not be located in the dynamic link library iAdCore.dll" Please help me to clear this error.
I faced the same issue. This solved it for me: Troubleshooting issues with iTunes for Windows updates
Hope this helps. -
I have Windows Vista computer. I am trying to upgrade my ITunes so can share files with other home computer. (Just got the new IPhone). I get this system error: The procedure entry point AVCFPlayerItemDurationChangedNotification could not be located in the dynamic link library AVFoundationCF.dll. Tries system restore and redownloaded...NOW Itunes will not even open. Can anyone help?
I uninstalled Apple Application Support, opened iTunesSetup with WinRar, and went down the list of msi's. AppleApplicationSupport was an install, all the others I did Repair. Did not have to reboot. Works okay now.
HTH -
This error happens each time I use Mozilla. especially when I click on an extension or try to work in any of my e-mail accounts (Yahoo, Gmail, or RCN). Sometimes I am able to continue by just clicking OK and other times it prevents me from completing my task. This started happening right after I downloaded and installed your latest version of Firefox. I see others are having the same problem. Error message is "Exc in ev handl:Error: Bad NPObject as private data"
That issue can be caused by the McAfee Site Advisor extension
*https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes
Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
*Don't make any changes on the Safe mode start window.
*https://support.mozilla.com/kb/Safe+Mode -
How to handle errors in a file at sender side?
Hi
I have done a file to proxy scenario.
I know how to handle errors on proxy.
But on sender side when picking the file if one the record have worng fomat its throwing mapping error and its not processing any record..
I wanted to process the records which have right format and data and all remaining recrods which have wromg format should be send back to the sender as file.
How to do this.
How to handle error in sender file.
Regards
SowmyaHello Sowmya,
In your scenario Three ways you can validate the data.
1) Before the data reaches into SAP system ie in XI system during Mapping or before mapping i,e in Adapter Module in the Sender side
2) this option, is in the receiver applications side. ie. Validations will be taken care in the SAP system i.e in ABAP server proxy code.
3)Through BPM, If Mapping Exception Occures then through exception Branch you can send bad formate file to sender again.
Generally, it is prefer to more business critical validations in the Application System ie Receiver Application System (ABAP Server Proxy)
In this, you can have more flexibility of the validations as you are validating some of the SAP payroll informations as Personal ID etc.
Based on the complexity and flexibility of the requirement, you can either do this in the XI (if XI, ie Sender Adapter Module or Mapping) or in the ABAP proxy
Thanks'
Sunil Singh -
Can't open PDF's on my Mac coming in on MS Outlook 2010. Reinstalled Adobe software 4 x and still get "Adobe PDF Preview Handler" error message.
No. Reader will not damage files. It is only meant to read pdf files. PDF files are frequently damaged when sent as email due to encoding issues.
-
I am trying to build an executible program that will be portable to machines which do not have CVI installed. It works fine on my CVI v9.1 system. However, whether or not I include "Full run-time support" in the build options, I get the error "The procedure entry point _UP_GetActiveTreeCell could not be located in the dynamic link library cvirte.dll" when I try to run it on a machine without CVI. Please help.
To run a CVI application on a system were the CVI IDE is not installed you need to have the CVI RunTime Engine installed. According to the error message at the bottom of this page you may have an older RTE installed in the target system.
To obtain it you can either download the RTE and install in the target system or better let the IDE build a distribution disk that installs all necessary software in it: this guide drives you in creating the appropriate installer for your application: you can find it also in CVI help function.
Proud to use LW/CVI from 3.1 on.
My contributions to the Developer Zone Community
If I have helped you, why not giving me a kudos? -
Can't launch itunes due to the following error; The procedure entry point AVCFPlayerAppliesMediaSelectionCriteriaKey could not be located in the dynamic link library AVFoundationCF.dll.
Hey bcolden,
I would try uninstalling and reinstalling following the directions in here:
Removing and reinstalling iTunes and other software components for Windows Vista, Windows 7, or Windows 8
http://support.apple.com/kb/HT1923
This section in particular contains important information in the uninstall process:
Use the Control Panel to uninstall iTunes and related software components in the following order and then restart your computer:
iTunes
Apple Software Update
Apple Mobile Device Support
Bonjour
Apple Application Support (iTunes 9 or later)
Important: Uninstalling these components in a different order, or only uninstalling some of these components may have unintended affects.
Let us know if following that article and uninstalling those components in that order helped the situation.
Welcome to Apple Support Communities!
Best,
Delgadoh -
I gets event handler error from the following applescript code if I leave the desktop space where "XLD" is running.
Is there a way to avoid this error and keep running the applescript?
tell application "System Events"
set wnd to front window of application process "XLD"
click button "Extract" of tool bar of wnd
delay 1
repeat while (name of front window of application process "XLD") = "Progress"
end repeat
end tellDo you have any Mail plug-ins installed? Mail Act-on, MailTags or whatever? If so, try disable them and then see if the scripts work.
Alternatively, you can access the iPhoto Library from within Mail:
Uploaded with plasq's Skitch!
Just drag and drop to the message.
Regards
TD -
Handle errors when makeing doc.submitForm()
Hello,
I am trying to submit PDF form by method doc.submitForm, example:
doc.submitForm
cURL: "http://localhost/reader_test.php?name=" + name.rawValue,
cSubmitAs: "XML"
A) With this approach, is it possible to handle connection errors and display custom error message (and cancel the original one) ?
I have tried something like
try{ doc.submitForm(...); } catch(e) { //handle code }
but it seems to be run asynchronously.
B) Is it possible to add custom HTTP headers to the POST ?
I saw that FormCalc can do it in Post() funciton, but when using Post() function, the Reader displays Yello-bar security dialog, that made our previous SOAP-based solution too complicated for the end user.
Appreciate any help.
RadekSofar I have not found the way how to handle errors when using doc.submitForms(), but there may be following workaround (mey be?):
The server returns as a response to a submitForms() call a pdf content, which is displayed as a document in a new Reader's window. Is it possible to place some javascript into this new window, that would refer to parent window and send to it some message ? Or at least to detect at the "parent" window, that a "child" window was opened ?
So is there any relation between the newly opened document with the response from server and the original document, that initiated calling of doc.submitForms()?
Thanks.
Maybe you are looking for
-
View jasper report in jsp page
i have developed a java code that could connect to the databse n compile xml code into jasper report. report is generated when it is executed in dos prompt. however i wan the report to appear after a button "print" in a jsp page is pressed. how do i
-
SMB or AFP? Connecting to an XRaid/XSan from a Mac
What's the preferred protocol when connecting from a Mac to a network volume on either a single XRaid or an Xsan volume? Any advantages to AFP? Any known issues? Any reasons to use SMB?
-
How to display PDF in a new browser?
Hi guys, I have generated PDF using adobe life cycle manager (transaction SFP) in WDA. Now the requirement is to show the PDF in a new browser. Both views are in the same WD object. I have tried different methods to get the PDF data into the new wind
-
Hi i have a typical scenario.i am extracting a flat file to BW-directories using open hub from an infocube say 1, which is built on another cube say 2 .the whole process is in process chain. the user only wants the records based on version from cube
-
Is it possible, to add multiple USB devices to TC
Is it possible, to add multiple USB devices using a hub to Time Capsule (as stated for Airport Extreme)? Thanks in advance. Stefan