بتاريخ: 3 مايو 200818 سنة comment_127963 3 - انتيه للدالة to_charلاحظ المثال التالي SQL> set serveroutput on SQL> declare 2 dob_month number(2) := 6; 3 dob_day number(2) := 6; 4 dob_year number(4) := 1960; 5 -- 6 hold_dob varchar2(8) := '06061960'; 7 begin 8 if to_char (dob_month, '09') = substr (hold_dob, 1, 2) and 9 to_char (dob_day, '09') = substr (hold_dob, 3, 2) and 10 to_char (dob_year, '9999') = substr (hold_dob, 5, 4) then 11 dbms_output.put_line ('Y'); 12 else 13 dbms_output.put_line ('N'); 14 end if; 15 -- 16 if dob_month = to_number (substr (hold_dob, 1, 2), '99') and 17 dob_day = to_number (substr (hold_dob, 3, 2), '99') and 18 dob_year = to_number (substr (hold_dob, 5, 4), '9999') then 19 dbms_output.put_line ('Y'); 20 else 21 dbms_output.put_line ('N'); 22 end if; 23 end; 24 . SQL> / N Y PL/SQL procedure successfully completed. SQL> و السبب ان الشرط الاول اعطى النتيجة n لان الدالة to_char تضيف فراغ space للارقام الموجبة فمثلا ('To_char (6, '09 تعطي النتيجة "09 " . لاحظ زيادة الفراغ في البداية .وبالتالي كانت نتيجة الشرط false تقديم بلاغ
بتاريخ: 6 مايو 200817 سنة comment_128138 مشكور يا أستاذ سالم وأن شاء الله تكون أمورك طيبه بالتوفيق إن شاء الله تم تعديل 6 مايو 200817 سنة بواسطة aljebli تقديم بلاغ
انضم إلى المناقشة
يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.