Can we handle the pre defined exceptions?
Hi people,
I have a simple stored procedure in oracle 9i with following code.
create or replace procedure psam1( no int) is
a number;
b number;
e exception;
v varchar(10);
begin
select sal into a from sample where sno=no;
select count(*) into b from sample where sno=no;
if b>1 then
raise e;
elsif a>1000 then
v:='PASS';
else
v:='FAIL';
end if;
dbms_output.put_line(v);
exception
when e then
raise_application_error(-20002,'MORE THAN ONE RECORD EXISTS');
end;
My question is if i want to handle the exception
'ORA-01422: exact fetch returns more than requested number of rows'.
If my fetch retrieves more than one row then Exception e should be raised.but can we handle those predefined exceptions?.
Hi Vids,
As said already, yes you can.
But there is some misunderstandig in your code. If in fact you do have ORA-01422, you second select will never get executed, since the first one will raise that.
You code could be as simple as this:
create or replace procedure psam1(no int)
is
a number;
v varchar(10);
begin
select sal, case sign(sal -1000)
when 1 then 'PASS'
else 'FAIL'
end
into a, v
from sample
where sno = no;
dbms_output.put_line(v);
exception
when no_data_found -- Predefined exception for ORA-00001
then
do_some_thing; -- Perhaps, just raise;
when too_many_rows -- Predefined exception for ORA-01422
then
do_another_thing; -- Perhaps, just raise;
end;As you see ORA-01422 is predefined (TOO_MANY_ROWS), read more about those here [Predefined PL/SQL Exceptions|http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28370/errors.htm#insertedID4]
If you choose just to (re)-raise the exception then you should omit that exception handler.
Regards
Peter
Similar Messages
-
How to raise the user defined Exceptions in XI ?
Hi All
I am learning XI ...i want know how to set up the user defined Exceptions
in XI?
Where and What are the settings need to be done ?
Same time where can check the LOG file ? to see all the server information ?
Welcome to your answers
Regards
RakeshRakesh,
Check this weblogs which will guide you:
/people/bhavesh.kantilal/blog/2006/07/25/triggering-xi-alerts-from-a-user-defined-function
/people/alessandro.guarneri/blog/2006/01/26/throwing-smart-exceptions-in-xi-graphical-mapping
/people/stefan.grube/blog/2005/12/30/test-user-defined-functions-for-the-xi-graphical-mapping-tool-in-developer-studio
Also check this thread:
Mapping test throughs exception for UDF that does'nt exist anymore
---Satish -
How to catch the user defined exception in application service
Hi All,
How to catch the user defined exception in application service when it is throwed by the external service..
Regards,
Thirumurugan.Hi,
Thanks for your reply,
Actually I am calling validate Login method of External service from the application service. When the login fails, my external service will throw user defined Exception.I want to catch the user defined Exception.
But in the application service , validate Login method can catch only Invocation Exception and Engine Exception.
These two exception are present in the Application service remote interface.
public com.sap.comptest.extsrv.accrjavawsvi__document.output.
Ns1_validateLoginResponse validateLogin(com.sap.comptest.extsrv.accrjavawsvi__document.input.Ns1_validateLogin input) throws com.sap.caf.mp.base.exception.InvocationException, com.sap.caf.mp.base.exception.EngineException;
User defined exception is not present there. When i include the webservice as external service in CAF, it suppossed to generate the java file for the custom exception of validate Login method and this generated file should be included in the application service remote interface..
public com.sap.comptest.extsrv.accrjavawsvi__document.output.
Ns1_validateLoginResponse validateLogin(com.sap.comptest.extsrv.accrjavawsvi__document.input.Ns1_validateLogin input) throws com.sap.caf.mp.base.exception.InvocationException, com.sap.caf.mp.base.exception.EngineException,
(generated file name of user defined Excpetion.
Then only validate login method of application service can catch the user defined Exception which is thrown by the external service.
regards,
Thirumurugan.p -
Does the pre-defined rules provide by SAP in PC 10?
Hi Everyone
I have two question about Process Control 10.
1. Rules, sample controls and scripts provided by SAP in PC 2.5.
Does the pre-defined rules provide by SAP in PC 10?
2. If it provide, how many?
I've read a lot of information about PC 10(RKT, Application Help, Master, Installation, Upgrade, Migration, and Operations Guides),but I can't find it..
Regards
NaotoHi Nato,
I believe GRC 10.0 versions are only avalaible for ramp-up's. There is a live expert session being arranged by SAP.
You could attend one of these for more info. You could look at this [thread|GRC Access Control 10; for more details about the webinar.
Thanks,
Chinmaya -
Can I Add the User Defined Unit system?
Can I add the User Defined Unit, Just like mm, inch..?
My Clients are Korean.
So. They want to use the Korean traditional Unit system which Not defined in Indesign.
Pls Help me.Impliment IUnitOfMeasure with custom units.
-
Since the update, some yahoo groups can't handle the format while others can.
I belong to many yahoo groups. I use yahoo for email. Most of the groups can handle posts made since the update, but one of them bounces my emails saying the site can't handle the new format.
== This happened ==
Every time Firefox opened
== since I updated Firefox, within the last month.Let me know if this doesn't work; this is how it works on ICS on a Bionic, and it may be different on a Razr/Maxx with JB:
Highlight the song you want to copy
At the bottom of the screen, there should be a 'copy' button (looks like two pages on top of each other), press it
At the top of the screen it should say '1 copied', press it
You should get a pop-up to choose between Device Storage and the SD Card, press Device Storage
Scroll to the Ringtones folder, press it
At the top of the screen on the right-hand side, you should see the word Paste, press it
And you're done (I hope!). -
Hi can I add the touch define to my iPad 4 my iPhone 5 has this feature when I touch word it give me two choices copy and define but only copy with iPad 4 please answer me
Because...!
I've no idea why either.
Although it isn't normally possible to sync an iPod/iPad/iPhone with two computers (or manually manage an iPhone from more than one) it can be achieved if all computers have copies of the self same library. See Re: how do i sync on a second laptop without the data on my iPhone 5 being erased?
tt2 -
How to create reports with the prompts like the pre-defined reports ?
We are analyzing pre-defined report: Historical Pipeline Analysis. When executed we can see the prompts for Pipeline Fiscal Quarter and Pipeline Fiscal Year.
If we open this analysis I cannot see how this prompt have been built.
If I save this pre-defined report (without any change) to My Folders and execute it from here, the prompts are gone.
I´d appreciate any help.
AntonioI have the same issue. The prebuilt reports are actually dashboards, which is why the dashboard prompt filters show up.
I'm not sure how they get it to be a link like that on the reports tab (since the link doesn't point to a dashboard URL ).
Any idea how to get this same effect assuming I built the dashboard/prompt around updated report? -
In the Oracel Web Application Server 4.0 documment, it says
about owa_text.vc_arr :Type vc_arr is table of varchar2(32767)
index by binary_integer.
I amusing PL_SQL with Oracle8i and OWA4.0 web server.I want to
use owa_text.vc_arr to pass the multple line texts in my form.
If the text length is less than 4000 characters, everything works
fine.However when the texts are longer than 4000 characters but
less than the max length 32767 characters, I got this error
message:
OWS-05101: Execution failed due to Oracle error 2005
ORA-02005: implicit (-1) length not valid for this bind or define
datatype.
Owa_text.vc_arr is supposed to handle the string with more
than 4000 characters, is it true? Could anyone tell me why? Any
help will be greatly appreciated!!!
Thanks very much.
Helena Wang
Here is the pl_sql procedure to create my form:
PROCEDURE myform
IS
BEGIN
htp.p('
<form action="'||service_path||'helena_test.saveform3"
method=post>
<input type=hidden name=tdescription value="X">
Input1: <textarea name=tdescription rows=50 cols=70
WRAP=physical></textarea>
Input2: <textarea name=tdescription rows=50 cols=70
WRAP=physical></textarea>
<input type=submit name=WSave value="Save">
</form>
END;
/***** here is the pl_sql procedure which I use to save the
form***/
procedure saveform3(tdescription in owa_text.vc_arr,
WSave in varchar2 default 'No')
is
len pls_integer;
begin
for i in 2..tdescription.count loop
len := length(tdescription(i));
htp.p(len);
htp.p(tdescription(i));
end loop;
end;Helena, I think you might get a better response either from the SQL-PL/SQL forum, or perhaps the Portal Applications forum - both of these tend to have folks very familiar with PL/SQL and the OWA packages.
This forum is on Web services based on SOAP, WSDL and UDDI. These can be PL/SQL based but typically don't use the mod_psql or OWA web solution.
As a pointer, I suspect you may already be familiar with, but just in case, you can always take a look at chapter 3 of the OAS documentation, "Developer's Guide: PL/SQL and ODBC Applications" where they go through a number of examples using parameters. See:
http://technet.oracle.com/doc/appsrvr4082/guides/plsql.pdf
Hope this or folks from the other list can help.
Mike. -
List of Pre-defined exceptions ???
Where can I find (on line)a list and description of pre-defined
and undefined exceptions ?
Thanks
Jordi"http://otn.oracle.com/doc/server.804/a58236/06_errs.htm"
-
Can I handle the outgoing AS2 MDN in a sync fashion ?
... before they are returned to the partner using the same http connection ?
As per the guide, it tells me there is no subscription to the messagebox. I need to capture the outgoing sync mdn before it is sent to the partner (connected to a request-response port), pretty much as we are doing so today with the outgoing async mdns.
Fabrikam will send us a message, the receive pipeline will validate, I need to handle the mdn resolution just before it goes back throught the as2 send pipeline. Is this possible ?Hi René,
Not tried it personally but I hope you can. I am not sure whether you can edit the disposition. But handle it like access it context properties etc.
Give it a go..
In case of synchronous mode, the MDN will
generated by the AS2 Decoder in the AS2Receive receive pipeline. You will get
MDN message (if enabled) as well as payload message
after the disassemble stage. Here (may be in party resolution stage) you can create a custom pipeline component to handle the MDN as per your requirement. At this stage you will have both the
MDN and AS2 message-payload, so you have to differentiate whether it’s a MDN or payload by the following code:
if (!(bool)inmsg.Context.Read("IsAS2PayloadMessage", "http://schemas.microsoft.com/BizTalk/2006/as2-properties"))
//Then this is a MDN not a AS2-Payload message
//Handle the MDN here..
Once the MDN has been generated (after you handle it), AS2 Encoder of AS2 Send pipeline
acts as a passthrough pipeline and route the MDN.
Refer
this BizTalk Hotrod magazine and check the “Custom Pipeline Component for Promoting Properties” section where the
author handle the payload where as in your case you have to handle the MDN.
Regards,
M.R.ASHWINPRABHU
If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply. -
My original iPad is slow and drops web pages and videos all the time now. Is the software just too old to handle the technology changes on the websites and video or is it a virus or junk in the iPad causing this? I have plenty or storage left on the iPad like 18GB. Sure would like to know. Maybe it is just too old to handle things now?
IIf you are running iOS 6.1.2, you could not be using the original iPad. No matter which iPad and what version, try these basic troubleshooting steeps and see if it helps with the performance.
Go to Settings>Safari>Clear History and Website Data. Then close all apps.
In order to close apps in iOS 5 or iOS 6, first tap the home button once. Then tap the home button twice and the recents tray will appear at the bottom of the screen. Tap and hold down on any app icon until it begins to wiggle. Tap the minus sign in the upper left corner of the app that you want to close. Tap the home button twice.
In order to close apps in iOS 7 or 8, you have to drag the app up from the multitasking display. Double tap the home button and you will see apps lined up going left to right across the screen. Swipe to get to the app that you want to close and then swipe "up" on the app preview thumbnail to close it.
Now reset your iPad. Reset the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider if it appears on the screen - let go of the buttons. Let the iPad start up.
You can also try resetting all settings. You will not lose any data, but most of the device settings will have to be entered in the settings app again. Settings>General>Reset>Reset all Settings. -
Can i uninstall the pre-installed final cut express?
There is the deal that when you buy a new mac you save a lot on final cut express.
The only problem is it comes pre-installed.
Could i uninstall it where i could use it on a different computer?For what it's worth, at least over the past 3 years, each time I have purchased the 'pre-installed' FCE with new Macs, it has always been delivered as a CD/DVD bundle that I have to install myself. It has never actually come pre-installed on the HD.
-
Arch-0.7.2-ftp.iso can't handle the new kernel [SOLVED]
hallo arch mates is there any problem when installer a fresh install from ftp with the new kernel some of my friends need to edit grup after install is it a error or is the arch-0.7.2-ftp.iso not build to handle the new kernel ??
Over And Out :?:Mh? I don't see a problem using 0.7.2 ftp install cd. Also not when editing grub file.
But if you get problems you might try this one http://bbs.archlinux.org/viewtopic.php?t=25236
cheers,
deTTo -
RuleFrame and BR's that should be handled the PRE or before triggers.
When a business rule must be handled before INSERT/UPDATE/DELETE of an record, it looks to me like it cannot be implemented using a CAPI.
For example the following BR:
'When value of column is NULL use default value retrieved from other column.'
Do I have to defer from CAPI implementation and use TAPI to implemented this BR in PRE-TRIGGER? Or is there a better way that fits more in the CAPI structure??
Regards,
SebastiaanSebastiaan,
From the CDM Standards & Guidelines Library, volume 2, chapter 7:
"However some change event rules should be implemented using the derivation expression mechanism given in Oracle Designer. This mechanism should be used when a value within the inserted or updated record must be derived or calculated as before the data is written to the database. [...] If more complex derivations are required, you will probably choose to create a derivation function as part of the Custom API, and then call this function in the derivation expression. Note that you must then set the
derivation expression type to Function Call."
For default values you may be able to use the Default Value property of a column (can also be a CAPI function call). However, it will only be applied if that column was not included in the insert call to the TAPI. Otherwise, you will have to use the Derivation Expression, and in the CAPI function you will then have to make sure that it is not executed during update, for example:
if g_inserting
then
return 100000;
else
return p_total_prj_limit;
end if;
Hope this helps,
Sandra
Maybe you are looking for
-
Know how memory that is free compared to the maximum allowed
Hi i want to know how memory is free compared to the maximum memory set in the jre advanced option or the defaut one this function is suppose to work, bu im not able to have something good, for example if i set -Xmx256m, so 256mo max thatr the jre ca
-
SAP CIN - Propose values during bill of entry.
Dear Friends, We have implemented the process for imported goods procurement and as standard process, we create bill of entry before GR. There are many line items in PO and each item having 7-8 duties, also the exchange rate might be different at the
-
This question sound funny. I just want to make sure this rule. In Oracle database before 10g, we can only use DML and transaction control code within PL/SQL block. We can not use DDL or other control languages within PL/SQL block. How about 10g? can
-
Hi,all: Now I face the problem as follow: 1.The delta upload can not run automatic finished.I can find some course in <b>SM58</b>,How to solve this problem? Can you give me some helps? 2.When I delta upload,system message like this: <i>Proce
-
Cannot change background color
I cannot change chart background color,can someone help me .