Welcome Guest ( Log In | Register )


 
 
 
 
 
 

 
 
Oracle 

Performance Tuning Reference poster
 
Oracle training in Linux 

commands
 
Oracle training Weblogic Book
 
Easy Oracle Jumpstart
 
Oracle training & performance tuning books
 
Burleson Consulting Remote DB Administration
 
 
 
Reply to this topicStart new topic
> Get raise_application_error messages from errorstack?
gerbenfeenstra
post May 15 2017, 05:18 AM
Post #1


Newbie
*

Group: Members
Posts: 1
Joined: 15-May 17
Member No.: 51,979



If I do a raise_application_error in one place of my program (DB backend), can I somehow retrieve this error through some errorstack in another part of my program (Forms application)?


For clarity, this is about a password_verify_function triggered by a DDL-statement to 'alter user'. It does all kinds of checks on the password and raises application error when the new password is at fault:

raise_application_error(-20001, 'This is a testerror');


The calling form (QMS0004F) does a 'forms_ddl'-call to do the 'alter user', which only returns a true or false boolean indicating the DDL statement either succeeded or failed. When false, I'd like to retreive the error and present it to the user. (I Don't necesarilly need a stacktrace, I just want to display the error and perhaps the errorcode.)


I tried some methods to get messages from the errorstack, like cg$errors.get_error_messages(), cg$errors.geterrors() and cg$errors.pop(), to no avail yet...
Go to the top of the page
 
+Quote Post
burleson
post May 22 2017, 09:31 AM
Post #2


Advanced Member
***

Group: Members
Posts: 13,438
Joined: 26-January 04
Member No.: 13



Hi, and welcome to the forum!

Sorry about the delay in responding!

>> can I somehow retrieve this error through some errorstack in another part of my program (Forms application)?

Yes!

This may help:

http://www.dba-oracle.com/t_raise_application_error.htm

<code>

-- a example trigger CREATE OR REPLACE TRIGGER
mytest_before BEFORE UPDATE ON mytest
FOR EACH ROW DECLARE
BEGIN
if :new.col_a < 0 then RAISE_APPLICATION_ERROR(-20299, 'negative value not allowed for column A');
end if;
END;
insert into mytest values (1,'hallo'); set serveroutput on DECLARE negative_value EXCEPTION

</code>




--------------------
Hope this helps. . .

Donald K. Burleson
Oracle Press author
Author of Oracle Tuning: The Definitive Reference
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 23rd June 2017 - 08:48 AM