How to trap cursor exception ?
Hi All,
I wrote PL/SQL by delcare , open ,fetch and close cursor and
trap exception (when OTHERS ) at the end of program then I want
program to check If cursor no record found then set variable
to something .
How to write exception in this case?
thank you
Mcka
Hi,
EXCEPTION
WHEN NO_DATA_FOUND THEN ...
Is that what you need?
Rod West
Similar Messages
-
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 AMuser4587979 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;
/ -
How to trap exchange exception in powershell ?
Hi all!
i try write handling some types of exceptions for Get-Recipient cmdlet. How must i define exceptions in catch block?
i work with exchange server in powershell, not im ems.
look like..
if i try execute get-recipient with wrong domain controller i get:
Get-Recipient aaaa -ErrorAction stop -DomainController dc0
An Active Directory error 0x51 occurred when trying to check the suitability of server 'dc0'. Error: 'Active directory response: The LDAP server is unavailable.'
At C:\Users\gsv\Documents\WindowsPowerShell\Modules\ExchangeModule\ExchangeModule.psm1:25039 char:9
+ $steppablePipeline.End()
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-Recipient], SuitabilityDirectoryException
+ FullyQualifiedErrorId : [Server=mbx1,RequestId=27f70386-fd1d-4e33-8e10-beb3c9aadeb5,TimeStamp=28.03.2015 5:14:50] [FailureCategory=Cmdlet-SuitabilityDirectoryException] B41D026,Microsoft.Exchange.Manageme
Microsoft.Exchange.Management.RecipientTasks.GetRecipient
+ PSComputerName : mbx1.domain.local
I see exception type eq
SuitabilityDirectoryException
and i try handle this type via
try{
Get-Recipient aaaa -ErrorAction stop -DomainController dc0
catch [SuitabilityDirectoryException]{
Write-Debug "dc do not work"
catch{
# something
and get error:
Unable to find type [SuitabilityDirectoryException]. Make sure that the assembly that contains this type is loaded.
For Active Directory cmdlets i use assembly name Microsoft.ActiveDirectory.Management and it's work.
For exchange i try to use or Microsoft.Exchange Microsoft.Exchange.Management or Microsoft.Exchange.Management.RecipientTasks but it's not work.
how should i write exception name in catch [ ... ] ?Have you tried using the FullName for the Type eg
catch [Microsoft.Exchange.Data.Directory.SuitabilityDirectoryException]{
Cheers
Glen -
How to trap ora-28000 (account is locked) from a remote db in pl/sql ??
i need to trap an ora-28000 (account is locked) exception comming from a remote db in my pl/sql block.
something like ...
declare
account_locked exception;
pragma exception_init(account_locked,-28000);
e number;
begin
begin
select dummy into e from dual@remote;
-- assign a query to a ref cursor
exception when acount_locked then
-- assign a different query to a ref cursor (not invloving the remote table)
end;
end;
/Here example, from local 10.2.0.3 to remote 8.1.7.4 :
SQL> conn system/demo102@demo102
Connected.
SQL> create database link mydbl connect to scott identified by tiger using 'demo817';
Database link created.
SQL> create or replace procedure myproc
2 is
3 account_locked exception;
4 pragma exception_init(account_locked,-28000);
5 e number;
6 begin
7 select count(*) into e from emp@mydbl;
8 dbms_output.put_line('ALL WORKD FINE');
9 exception when account_locked then dbms_output.put_line('ACCOUNT LOCKED WAS CATCHED');
10 when others then dbms_output.put_line('ACCOUNT LOCKED WAS NOT CATCHED');
11 end;
12 /
Procedure created.
SQL> conn system/manager@demo817
Connected.
SQL> alter user scott account lock;
User altered.
SQL> conn system/demo102@demo102
Connected.
SQL> set serveroutput on
SQL> exec myproc
ACCOUNT LOCKED WAS CATCHED
PL/SQL procedure successfully completed.
SQL> Here example, from local 8.1.7.4 to remote 10.2.0.3, I got the same error as your, but nothing to do with account locked or not, need to set to FALSE the GLOBAL_NAMES on the 8i db :
SQL> conn system/manager@demo817
Connected.
SQL> create database link mydbl connect to scott identified by demo102 using 'demo102';
Database link created.
SQL> create or replace procedure myproc
2 is
3 account_locked exception;
4 pragma exception_init(account_locked,-28000);
5 e number;
6 begin
7 select count(*) into e from emp@mydbl;
8 dbms_output.put_line('ALL WORKD FINE');
9 exception when account_locked then dbms_output.put_line('ACCOUNT LOCKED WAS CATCHED');
10 when others then dbms_output.put_line('ACCOUNT LOCKED WAS NOT CATCHED');
11 end;
12 /
create or replace procedure myproc
ERROR at line 1:
ORA-04052: error occurred when looking up remote object
[email protected]
ORA-00604: error occurred at recursive SQL level 1
ORA-02085: database link MYDBL.US.ORACLE.COM connects to
DEMO102.REGRESS.RDBMS.DEV.US.ORACLE.COM
SQL> alter system set global_names=false;
System altered.
SQL> create or replace procedure myproc
2 is
3 account_locked exception;
4 pragma exception_init(account_locked,-28000);
5 e number;
6 begin
7 select count(*) into e from emp@mydbl;
8 dbms_output.put_line('ALL WORKD FINE');
9 exception when account_locked then dbms_output.put_line('ACCOUNT LOCKED WAS CATCHED');
10 when others then dbms_output.put_line('ACCOUNT LOCKED WAS NOT CATCHED');
11 end;
12 /
Procedure created.
SQL> conn system/demo102@demo102
Connected.
SQL> alter user scott account lock;
User altered.
SQL> conn system/manager@demo817
Connected.
SQL> set serveroutput on
SQL> exec myproc
ACCOUNT LOCKED WAS CATCHED
PL/SQL procedure successfully completed.
SQL> HTH,
Nicolas. -
Trapping cursor coordinates in Javascript
Hello Everyone:
I am attempting to trap cursor coordinates but I do not know how to make that happen. Here is the short algorithm I hope to implement:
click object to select.
click new location for object to move to
move object to new location.
I think I know how to do the first, but I have no idea how to make Javascript report the coordinates of the mouse cursor when I click on the new location.
Please share with me any thoughts/documentation/snippets that might help. I will greatly appreciate it.
TIA.
John@John – if you are using InDesign CS5 (or above) I have something for you.
At least a proof of concept that will work. Tested with InDesign CS5.5.
The script will not read out any cursor coordinates.
Unfortunately we cannot do this…
Instead I am using:
one event listener,
an JPEG image already placed,
the placeGun
and the "afterSelectionChanged" event.
To test the script below, you need:
1.A The ESTK open, run the script from that
OR:
1.B Run the script with a keyboard shortcut from InDesign's Scripts Panel
2. An open document
3. An already placed JPEG image in the document (with a link status OK)
4. One single page item selected (no text selected, not more than one object selected)
This is just a proof of concept!
I did not consider moving a selection greater than one object, I needed at least ONE image placed in the document, I did not consider double sided spreads with a coordiante system set by page.
And: I really had fun writing this!
Here the script (ExtendScript/JavaScript):
//MoveSelectionTo_POSITION-OF-CURSOR_ProofOfConcept.jsx
//Uwe Laubender
//DESCRIPTION:Just a proof of concept. Some pieces missing!
#targetengine "MovePositionToCursor[Proof Of Concept ONLY]"
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
//SOME CHECKS:
if(parseFloat(app.version)<7){alert("Does not run in InDesign v. "+app.version);exit()};
if(app.documents.length == 0){alert("No document open!");exit()};
if(app.selection.length !== 1 && !app.selection[0].hasOwnProperty("baselineShift")){
alert("This is a proof of concept! Does ONLY work with ONE page item selected. NOT TEXT!");
exit();
if(app.documents[0].allGraphics.length == 0){
alert("This is a proof of concept! Does ONLY work with AT LEAST ONE JPEG ALREADY placed!");
exit();
moveSelection();
function moveSelection(){
var myDoc = app.documents[0];
var myOriginalSel = app.selection[0];
var myOriginalSelID = myOriginalSel.id;
for(var n=0;n<myDoc.links.length;n++){
if(myDoc.links[n].status == LinkStatus.NORMAL && myDoc.links[n].linkType == "JPEG"){
var myImage = File(myDoc.links[n].filePath);
break;
if(myImage){myDoc.placeGuns.loadPlaceGun(myImage)}
else{
alert("This is a proof of concept! Does ONLY work with AT LEAST ONE JPEG ALREADY placed!");
exit();
app.addEventListener("afterSelectionChanged", doSomething);
app.select(app.documents[0].pageItems.itemByID(myOriginalSelID));
function doSomething(myEvent){
try{
app.removeEventListener("afterSelectionChanged", doSomething);
var myNewID = app.selection[0].id;
var myGeoBounds = app.selection[0].getElements()[0].geometricBounds;
app.documents[0].pageItems.itemByID(myNewID).remove();
app.documents[0].pageItems.itemByID(myOriginalSelID).move([myGeoBounds[1],myGeoBounds[0]]);
app.select(app.documents[0].pageItems.itemByID(myOriginalSelID));
}catch(e){};
Uwe -
How to trap No_Data_Found error?
I know how to trap this error in a back-end script:
BEGIN
select empno
into v_empno
where empno = 9999999; --no such employee
EXCEPTION
WHEN NO_DATA_FOUND THEN
However when I use this approach within a trigger in Form 10g, it fails me. I've experimented with DBMS_ERROR_CODE, but so far got nowhere. Can same approach be used in Forms as I'm using above? If not, how should I approach it?
Thanks a lot!You should write something like this......
declare
v_empno emp.empno%type;
begin
begin
select empno into v_empno
from emp
where empno=99999;
exception
when no_data_found
then
message('no employee found');
end;
<any other code >
end;Greetings...
Sim -
Too many open cursors exception caused by LRS Iterator
Using Kodo4.1.4 with Oracle10, and Large Result Set Proxies, I encountered
the error "maximum number of open cursors exceeded".
It seems to have been caused because of incomplete LRSProxy iterators within
the context of a single PersistenceManager. These iterators were over
collections obtained by reachability, not directly from Queries or Extents.
The Iterator is always closed, but the max-cursors exception still occurs.
Following is a pseudocode example of the case... Note that if the code is
refactored to remove the break; statement, then the program works fine, with
no max-cursors exception.
Any suggestions?
// This code pattern is called hundreds of times
// within the context of a PersistenceManager
Collection c = persistentObject.getSomeCollection(); // LRS Collection
Iterator i = c.iterator()
try
while(i.hasNext())
Object o = i.next();
if (someCondition)
break; // if this break is removed, everything is fine
finally
KodoJDOHelper.close(i);
}XSQL Servlet v. 0.9.9.1
Netscape Enterprise / JRUN 2.3.3 / Windows NT
I modified the document demo (insert request).
The XSQL document:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="newdocinsform.xsl"?>
<page connection="demo" xmlns:xsql="urn:oracle-xsql">
<xsql:insert-request table="xmlclob" transform="newdocins.xsl"/>
<data>
<xsql:query null-indicator="yes" max-rows="4">
select id, doc
from xmlclob
order by id desc
</xsql:query>
</data>
</page>
The difference between this and your demo is the table: the table xmlclob has
ID NUMBER and DOC CLOB. No constraints were enforced, so I was inserting the ID and the DOC. Upon page reload, several rows with the same values were inserted.
I had a similar problem in the previous release.
As a general question, how can I configure the XSQLConfig file for optimal performance?
Although you provided default values, I'm not sure how much is necessary for connection pooling. -
How to log the exception using Log action in Oracle Service Bus
Hi,
Whenever an exception is raised how to log the exception using Log action in oracle service bus.After logging where I have to find the logged message.It would be in the log file for the managed server which ran the request. If you are logging the message at a lower level than your app server, however, you won't see it. You should be logging the exception at Error level.
-
How to catch ALL Exception in ONE TIME
I'm explain my issue:
I'm making a program with Class, Swing, Thread ...
Then all action I do on my graphical application, I use a new thread, well
I want to capture in my Startup programs, all unknow exception and then, I display it with a JOptionPane for example
In fact, I want to do something like Eclipse, when it crash, I capture the error
Could you help me ? Tell me the best way to do that ?
This is an exemple
FILE: Startup.java
class Startup{
public static main (String args[]){
try{
new Main();
}catch(Throwable e){
//Message d'erreur fenetre
FILE: Main.java
class Main{
Main(){
init_action();
void init_action(){
mybutton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
Thread th=new Thread(){
public void run(){
int a = 1 / 0;
th.start();
Well, in this example I want to capture the Divide By 0, I use the Throwable Exeption, in order to be sure I catch all unknow exeption
Then, a good job, is to put throws Throwable in all function
but Thread, and ActionPerformed ... could not implement it
How to put this exception and jump it to Startup Program ?I already do that, what can I do for improving capture ?
That's impossible ... It will be a great idea to make a Redirection of Error to a Exception class in futur version
For example, when an unknow error arrive, don't show it on console and crash ... but run a class redirector exception, and magic, it show you a beautiful error warning, and stop properly the programme ...
I put an error class, and put try {] catch {} everywhere, and run my exception class,
this class detect the error exception and run a properly beautiful and clear french message (I'm french :d)
Well, If you have the BEST other idea, tell me, I read your message with a lot of regard
see you soon
bye -
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
binduHi 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 -
Command for "How to find Cursor Size" in Oracle Stored Procedure"
Hi
Can u tell me....
How to find Cursor Size" in Oracle Stored Procedure........
I want command for that........why don't you try select count(*) from your_table;That requires running the same query twice - or rather running two different queries twice. Besides it still doesn't guarantee anything, because Oracle's read consistency model only applies at the statement level (unless you're running in a serialized transaction).
This is such a common requirement - users are wont to say "well Google does it" - it seems bizarre that Oracle cannot do it. The truth is that that Google cheats. Firstly it guesses the number on the basis of information in its indexes and refines the estimate as pages are returned. Secondly, Google is under no onus to kepp all its data and indexes synchronized - two simultaneous and identical queries which touch different Google servers can return different results. Oracle Text works the same way, which is why we can get a count with CTX_QUERY.COUNT_HITS in estimate mode.
Cheers, APC
blog: http://radiofreetooting.blogspot.com
. -
How to bring cursor in Table control??
Hi to all
How to bring cursor in Table control when entering into screen
can anyone tell me??? pls explain with example..
thanks
senthilHi,
Check the below code
data l_tc_name like feld-name.
data l_tc_field_name like feld-name.
get actual tc and column
get cursor field l_tc_field_name
area l_tc_name.
Regards,
Vind -
How to configure fault exception
I have a scenario rfc to soap,even if the input data from rfc is worng or unauthorised than inspite of rfc going to dump,i want a msg like unauthorised even the scenario is failed..i think this can be possible by creating fault exception error....
I have an error in moni this error is because of unauthorisation...
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> - <!-- Call Adapter --> - <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1"> <SAP:Category>XIAdapter</SAP:Category> <SAP:Code area="PARSING">ADAPTER.SOAP_EXCEPTION</SAP:Code> <SAP1 /> <SAP2 /> <SAP3 /> <SAP4 /> <SAP:AdditionalText>soap fault: [Security:090304]Authentication Failed: User javax.security.auth.login.FailedLoginException: [Security:090302]Authentication Failed: User denied</SAP:AdditionalText> <SAP:ApplicationFaultMessage namespace="" /> <SAP:Stack /> <SAP:Retry>M</SAP:Retry> </SAP:Error>
In Message monitoring
SOAP: response message contains an error XIAdapter/PARSING/ADAPTER.SOAP_EXCEPTION - soap fault: [Security:090304]Authentication Failed: User javax.security.auth.login.FailedLoginException: [Security:090302]Authentication Failed: User denied
Can any please tell me how to configure fault exception in my scenario...Hi
Go thro the following links for knowing things about Fault Messages.
Fault Message Type
http://help.sap.com/saphelp_nw04/helpdata/en/5d/a45c3cff8ca92be10000000a114084/frameset.htm
hope this helps.
regards,
P.Venkat -
How to write the exceptions in function module
dear all,
how to write the exceptions in function modules with example.
thanq
jyothiHi,
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 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
Maybe you are looking for
-
Logic 10.0.2 Bypass Bug For Multi Output Instruments
It appears the 10.0.2 update causes Logic to crash when bypassing multi-output Instruments. -SD
-
How do i draw a graph in a applet from ny data
Hi, again sorry to keep coming back to you guys, but i have been trying hard to attempt things myself.I have read loads of books and can not find example to work from.I have managed with your "help" to finnish my calculations. Now i need to plot a gr
-
Auto accept script reports -1708 error on startup
Hey everyone, I was just wondering if I was the only one experiencing a -1708 error when using the Auto accept apple script. I'm tired of always accepting chat invitations / messages, so I turned on the script. Now it's reporting a -1708 error. I tri
-
I have had a session recorded and they have supplied me WAV files which I cannot import into Captivate. I can open the files in Wavpad editor and save them as - 44100-32bit Mono and they import fine. I have asked the studio to re-do all the audio for
-
I'm a long time Netscape user with 3 POP mailboxes. I tried to set up in iMail on new MacBookPro with Leopard, but it won't let me put folders under the mailboxes - only "on my computer", If I reply from them, it uses my "primary" email as the sender