APEX_ERROR_HANDLING_EXAMPLE _____________________________ 1-function ___________________ create or replace FUNCTION "APEX_ERROR_HANDLING_EXAMPLE" ( p_error in apex_error.t_error ) return apex_error.t_error_result is l_result apex_error.t_error_result; l_reference_id number; l_constraint_name varchar2(255); begin l_result := apex_error.init_error_result ( p_error => p_error ); -- If it's an internal error raised by APEX, like an invalid statement or -- code which can't be executed, the error text might contain security sensitive -- information. To avoid this security problem we can rewrite the error to -- a generic error message and log the original error message for further -- investigation by the help desk. if p_error.is_internal_error then -- Access Denied errors raised by application or page authorization should -- still show up with the original error message if p_error.apex_error_code 'APEX.AUTHORIZATION.ACCESS_DENIED' then -- log error for example with an autonomous transaction and return -- l_reference_id as reference# -- l_reference_id := log_error ( -- p_error => p_error ); -- -- Change the message to the generic error message which doesn't expose -- any sensitive information. l_result.message := 'An unexpected internal application error has occurred. '|| 'Please get in contact with XXX and provide '|| 'reference# '||to_char(l_reference_id, '999G999G999G990')|| ' for further investigation.'; l_result.additional_info := null; end if; else -- Always show the error as inline error -- Note: If you have created manual tabular forms (using the package -- apex_item/htmldb_item in the SQL statement) you should still -- use "On error page" on that pages to avoid loosing entered data l_result.display_location := case when l_result.display_location = apex_error.c_on_error_page then apex_error.c_inline_in_notification else l_result.display_location end; -- If it's a constraint violation like -- -- -) ORA-00001: unique constraint violated -- -) ORA-02091: transaction rolled back (-> can hide a deferred constraint) -- -) ORA-02290: check constraint violated -- -) ORA-02291: integrity constraint violated - parent key not found -- -) ORA-02292: integrity constraint violated - child record found -- -- we try to get a friendly error message from our constraint lookup configuration. -- If we don't find the constraint in our lookup table we fallback to -- the original ORA error message. if p_error.ora_sqlcode in (-1, -2091, -2290, -2291, -2292) then l_constraint_name := apex_error.extract_constraint_name ( p_error => p_error ); begin select message into l_result.message from constraint_lookup where constraint_name = l_constraint_name; exception when no_data_found then null; -- not every constraint has to be in our lookup table end; end if; -- If an ORA error has been raised, for example a raise_application_error(-20xxx, '...') -- in a table trigger or in a PL/SQL package called by a process and we -- haven't found the error in our lookup table, then we just want to see -- the actual error text and not the full error stack with all the ORA error numbers. if p_error.ora_sqlcode is not null and l_result.message = p_error.message then l_result.message := apex_error.get_first_ora_error_text ( p_error => p_error ); end if; -- If no associated page item/tabular form column has been set, we can use -- apex_error.auto_set_associated_item to automatically guess the affected -- error field by examine the ORA error for constraint names or column names. if l_result.page_item_name is null and l_result.column_alias is null then apex_error.auto_set_associated_item ( p_error => p_error, p_error_result => l_result ); end if; end if; return l_result; end apex_error_handling_example; ____________________ 2- table ___________ CREATE TABLE "CONSTRAINT_LOOKUP" ( "CONSTRAINT_NAME" VARCHAR2(30), "MESSAGE" VARCHAR2(4000) NOT NULL ENABLE, PRIMARY KEY ("CONSTRAINT_NAME") ENABLE ) ________________
@zuhairabdullahfadhel84323 жыл бұрын
شكرا ياباشا وبارك الله فيك وجزاك كل خير
@alisaleh843 жыл бұрын
@@zuhairabdullahfadhel8432 شكر لذوق حضرتك تابع احدث كورساتى من هنا www.udemy.com/course/full-track-be-oracle-apex-developer/?referralCode=FF289BAA30C6C18C8540
@samirarem87867 жыл бұрын
Thanks ! 'Allah Yjazik Khair' for your valuable help
Now I have a query, from a process I invoke a procedure of a package when pressing a button on the form, what the procedure does is insert records to a table and then in APEX I have a branch that takes me to a new page where I show the results in an interactive report. The process starts normal but when it takes a few minutes the cursor process circle stops appearing and the cursor arrow appears as I have finished, but I go to the sql developer to consult the table and the data is not there yet, in the course of about 10 minutes the data appears. I need the process to finish and run the branch to see the results in the interactive report on the other page then it doesn't branch me after processing to load the page with the results. What are you suggesting?
@alisaleh843 жыл бұрын
try to add log in every step to get where the error exactly
@esamgamal27505 жыл бұрын
هل ممكن ارسال function ، لاني احتاجها ضروري
@alisaleh845 жыл бұрын
APEX_ERROR_HANDLING_EXAMPLE ___________________________ 1-function _________________ create or replace FUNCTION "APEX_ERROR_HANDLING_EXAMPLE" ( p_error in apex_error.t_error ) return apex_error.t_error_result is l_result apex_error.t_error_result; l_reference_id number; l_constraint_name varchar2(255); begin l_result := apex_error.init_error_result ( p_error => p_error ); -- If it's an internal error raised by APEX, like an invalid statement or -- code which can't be executed, the error text might contain security sensitive -- information. To avoid this security problem we can rewrite the error to -- a generic error message and log the original error message for further -- investigation by the help desk. if p_error.is_internal_error then -- Access Denied errors raised by application or page authorization should -- still show up with the original error message if p_error.apex_error_code 'APEX.AUTHORIZATION.ACCESS_DENIED' then -- log error for example with an autonomous transaction and return -- l_reference_id as reference# -- l_reference_id := log_error ( -- p_error => p_error ); -- -- Change the message to the generic error message which doesn't expose -- any sensitive information. l_result.message := 'An unexpected internal application error has occurred. '|| 'Please get in contact with XXX and provide '|| 'reference# '||to_char(l_reference_id, '999G999G999G990')|| ' for further investigation.'; l_result.additional_info := null; end if; else -- Always show the error as inline error -- Note: If you have created manual tabular forms (using the package -- apex_item/htmldb_item in the SQL statement) you should still -- use "On error page" on that pages to avoid loosing entered data l_result.display_location := case when l_result.display_location = apex_error.c_on_error_page then apex_error.c_inline_in_notification else l_result.display_location end; -- If it's a constraint violation like -- -- -) ORA-00001: unique constraint violated -- -) ORA-02091: transaction rolled back (-> can hide a deferred constraint) -- -) ORA-02290: check constraint violated -- -) ORA-02291: integrity constraint violated - parent key not found -- -) ORA-02292: integrity constraint violated - child record found -- -- we try to get a friendly error message from our constraint lookup configuration. -- If we don't find the constraint in our lookup table we fallback to -- the original ORA error message. if p_error.ora_sqlcode in (-1, -2091, -2290, -2291, -2292) then l_constraint_name := apex_error.extract_constraint_name ( p_error => p_error ); begin select message into l_result.message from constraint_lookup where constraint_name = l_constraint_name; exception when no_data_found then null; -- not every constraint has to be in our lookup table end; end if; -- If an ORA error has been raised, for example a raise_application_error(-20xxx, '...') -- in a table trigger or in a PL/SQL package called by a process and we -- haven't found the error in our lookup table, then we just want to see -- the actual error text and not the full error stack with all the ORA error numbers. if p_error.ora_sqlcode is not null and l_result.message = p_error.message then l_result.message := apex_error.get_first_ora_error_text ( p_error => p_error ); end if; -- If no associated page item/tabular form column has been set, we can use -- apex_error.auto_set_associated_item to automatically guess the affected -- error field by examine the ORA error for constraint names or column names. if l_result.page_item_name is null and l_result.column_alias is null then apex_error.auto_set_associated_item ( p_error => p_error, p_error_result => l_result ); end if; end if; return l_result; end apex_error_handling_example; __________________ 2- table _________ CREATE TABLE "CONSTRAINT_LOOKUP" ( "CONSTRAINT_NAME" VARCHAR2(30), "MESSAGE" VARCHAR2(4000) NOT NULL ENABLE, PRIMARY KEY ("CONSTRAINT_NAME") ENABLE ) ______________
@ahmadkaremm39216 жыл бұрын
السلام عليكم هل يجب ان اعرف apex_error.t_error لانه يعطيني رسالة خطا عند انشاء الدالة
@alisaleh846 жыл бұрын
لا ليس شرط ممكن تبعت صوره من الخطأ
@ahmadkaremm39216 жыл бұрын
اناعندي apex 4.2 وقمت بانشاء الدالة من toad تحت ال schema الخاص بتطبيق بتاعي
@ahmadkaremm39216 жыл бұрын
PLS-00201: identifier 'APEX_ERROR.T_ERROR' must be declared
@alisaleh846 жыл бұрын
حاول تنفذه من جوه الابكس
@ahmadkaremm39216 жыл бұрын
شكرا على الرد حتى اني لم اجد بصفحة ال definition hanler error function من اجل اختيار التابع فقط يوجد مكان اظهار ال error بالصفحة
@maiankithun6 жыл бұрын
good job dude. Just one doubt. it is not working in upload wizard
@alisaleh846 жыл бұрын
Ok brother i will test it
@Mhmsami074 жыл бұрын
Thanks for your effort but sometimes constraint name didn't return with Apex_Error.extract_constraint_name ??
@alisaleh844 жыл бұрын
Like what Check constraint name and type
@alisaleh844 жыл бұрын
full course from here www.udemy.com/course/full-track-be-oracle-apex-developer/?couponCode=APEX_5
@Mhmsami074 жыл бұрын
@@alisaleh84 like check contraint for value is not null Example employees has check contraint of last name must be not null I added the name of constraint in table of lookup. I traced the value of variable l_constraint_name i noticed that this variable is null but i don't know why!! Thanks in advance
@alisaleh844 жыл бұрын
@@Mhmsami07 first not null it can done direct from app second check that constraint type not null is existed in function