oracle - Getting extra messages while executing a trigger -



oracle - Getting extra messages while executing a trigger -

i'm facing problem while creating db trigger raise error message oracle forms. can please help me out?

my code is:

create or replace trigger unsuccessful_attempts_lock before update of last_logon_date on temp_user each row declare cursor c_unsuccessful_attempts select * temp_unsuccessful_attempts user_id=:new.user_id; max_fails exception; begin r_unsuccessful_attempts in c_unsuccessful_attempts loop if(r_unsuccessful_attempts.locked ='y') raise max_fails; end if; end loop; exception when max_fails fnd_message.set_name ('fnd', 'flex-user defined error'); fnd_message.set_token ('msg', 'you have reached maximum failed logins. business relationship has been locked temporarily. please contact scheme administrator') fnd_message.raise_error; when others raise_application_error(-20400,'an error has occured.please contact scheme administrator'||sqlcode||sqlerrm); end unsuccessful_attempts_lock;

once user's business relationship locked, temp_unsuccessful_attempts.locked updated 'y' , he/se should not able login further. , temp_user table gets updated when user has successful login.

so, 1 time user's acount locked(temp_unsuccessful_attempts.locked='y') , if he'll seek login right password, tis trigger should fire(upon updation of temp_user table) , form should give error business relationship locked , should not progress further.

message i'm getting is:

oracle error -20001: ora-20001: flex-user defined error:n, msg, have reached maximum failed logins. please contact scheme administrator.

ora-06512: @ "apps.fnd_message",line 66

ora-06512: @ "apps.unsuccessful_attempts_locks",line 38

ora-04088: error during excution of trigger 'apps.unsuccessful_attempts_locks' has been detected in fnd_signon.new_session.

my trigger giving message on oracle apps screen. want display

you have reached maximum failed logins.your business relationship locked temporarily.please contact helpdesk.

p.s: fnd_signon.new_session procedure temp_user.last_logon_date getting updated.

here utilize function get's first error of stack:

function strip_first_error(pcode in number, pmessage in varchar2) homecoming varchar2 -- vpos number := instr(pmessage, 'ora-', 5); -- begin if pcode between 20000 , 20999 if vpos != 0 return( substr(substr(pmessage, 1, vpos -2 ),12) ); else return( substr(pmessage,12) ); end if; else homecoming pmessage; end if; end;

and usage is:

when others message(strip_first_error(abs(sqlcode), sqlerrm));

edit

p.s.: when others handle errors in phone call of update. in specific illustration should be:

begin update last_logon_date ... exception when others -- in forms should utilize message or other function display error -- in pl/sql should utilize dbms_output.put_line, example. dbms_output.put_line( strip_first_error(abs(sqlcode) , sqlerrm) ); end;

oracle plsql triggers oracle-apps

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -