الانتقال إلى المحتوى

calling function


rabie123

Recommended Posts

ORA-06550: line 82, column 71: PLS-00302: component 'GET_ERROR' must be declared

لدينا package  بها  2  function   

لما استدعى ال function  الثانية تظهر المشكلة

لانى جربتها فى مصال بسيط تأكدت انه ينفذ الدالة الاولى ويعطى رسالة الخطأ السابقة عند استدعاء الدالة الثانية

create or replace package "ERROR_HANDLING_PKG" as
  
    -- تعريف الدالة handle_error
    FUNCTION handle_error(p_error IN apex_error.t_error) 
    RETURN apex_error.t_error_result;

      -- تعريف الدالة get_error
    FUNCTION get_error(p_error IN apex_error.t_error) 
    RETURN apex_error.t_error_result;

end "ERROR_HANDLING_PKG";

رابط هذا التعليق
شارك

شكرا لك

EXCEPTION
    WHEN OTHERS THEN
        DECLARE
            l_error_result apex_error.t_error_result;
        BEGIN
            l_error_result := error_handling_pkg.get_error(apex_error.get_error);
            -- عرض الرسالة للمستخدم
            apex_error.add_error(p_message => l_error_result.message);
           --null;
                
        END;

 

 

create or replace package body "ERROR_HANDLING_PKG" as
     
 
    FUNCTION handle_error(p_error IN apex_error.t_error) 
    RETURN apex_error.t_error_result IS
        l_result apex_error.t_error_result;
    BEGIN
        l_result := apex_error.init_error_result(p_error => p_error);

        -- إضافة رقم الخطأ والرسالة إلى النتيجة
        l_result.message := 'Error Code: ' || p_error.ora_sqlcode || ' - ' || p_error.message;

        -- تخصيص الرسالة بناءً على نوع الخطأ
        IF p_error.is_internal_error THEN
            l_result.message := 'An unexpected internal application error has occurred. Please contact support.';
        END IF;

        -- إرجاع النتيجة
        RETURN l_result;
    END handle_error;

FUNCTION get_error(p_error IN apex_error.t_error) 
    RETURN apex_error.t_error_result IS
        l_result apex_error.t_error_result;
    BEGIN
        -- استدعاء دالة handle_error لمعالجة الخطأ
        l_result := handle_error(p_error);
        
        -- يمكنك إضافة المزيد من المنطق هنا إذا لزم الأمر

        RETURN l_result;
    END get_error;

end "ERROR_HANDLING_PKG";

رابط هذا التعليق
شارك

انضم إلى المناقشة

يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.

زائر
أضف رد على هذا الموضوع...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   تمت استعادة المحتوى السابق الخاص بك.   مسح المحرر

×   You cannot paste images directly. Upload or insert images from URL.

جاري التحميل
×
×
  • أضف...

برجاء الإنتباه

بإستخدامك للموقع فأنت تتعهد بالموافقة على هذه البنود: سياسة الخصوصية