الانتقال إلى المحتوى
View in the app

A better way to browse. Learn more.

مجموعة مستخدمي أوراكل العربية

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Truth Table

Featured Replies

بتاريخ:

السلام عليكم ورحمة الله وبركاته...
اليكم هذه الطريقة لعمل الــ truth table :
اولا نقوم بانشاء جدول وهو كالتالي:

create table booleans (
 bool varchar2(5)
);



وبعد ذلك دعونا ندخل على هذه الجدول بيانات وهي كالاتي:

insert into booleans values ('true');
insert into booleans values ('false');
insert into booleans values ('null');



والان سنقوم بعملية المقارنه...نحن تعلمنا أن truth and truth = truth وبالفنكشن التالي سنستخرج جميع الاحتمالات:

declare 
 bool_1   boolean;
 bool_2   boolean;

 bool_and boolean;
 bool_or  boolean;

 res_and  varchar2(5);
 res_or   varchar2(5);

 function string_to_bool(str in varchar2) return boolean is begin
return case when str = 'true'  then true
			when str = 'false' then false
			when str = 'null'  then null end;
end;

 function bool_to_str(bool in boolean) return varchar2 is begin
return case when bool =  true   then 'true'
			when bool =  false  then 'false'
			when bool is null   then 'null' end;
end;

begin

 dbms_output.put_line('bool1  bool2|   and	 or');
 dbms_output.put_line('------------+-------------');

 for b1 in (select bool from booleans) loop
 for b2 in (select bool from booleans) loop

bool_1 := string_to_bool(b1.bool);
bool_2 := string_to_bool(b2.bool);

bool_and := bool_1 AND bool_2;
bool_or  := bool_1 OR  bool_2;

res_and  := bool_to_str(bool_and);
res_or   := bool_to_str(bool_or );

dbms_output.put_line(lpad(b1.bool, 5) || '  ' ||
					 lpad(b2.bool, 5) || '| ' ||
					 lpad(res_and, 5) || '  ' ||
					 lpad(res_or , 5));
 
 end loop; end loop;
end;
/



وبالتالي ستكون النتيجة على النجو الاتي:

bool1  bool2|   and	 or
------------+-------------
true   true|  true   true
true  false| false   true
true   null|  null   true
false   true| false   true
false  false| false  false
false   null| false   null
null   true|  null   true
null  false| false   null
null   null|  null   null



جربوها....
التوفيق للجميع...

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

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

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

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

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

Account

Navigation

البحث

إعداد إشعارات المتصفح الفورية

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.