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

Code لحساب أعلى مرتب بدون استخدام Max وايضا Code لحساب مجموع المرتب بدون استخدام Sum


محمد فتحى باشا

Recommended Posts

فى محاولة منى لخدمة هذا المنتدى الذى علمنى الكثير

لكم منى هذا الكود

1-لحساب اعلى مرتب بدون استخدام الدالة max

declare
x number;
y number:=0;
cursor cur_sal is select sal from emp;
begin
open cur_sal;
loop
fetch cur_sal into x;
exit when cur_sal%notfound;
if (x>y) then
y:=x;
end if;
end loop;
close cur_sal;
dbms_output.put_line('max sal without using max function = '||y);
end;




2-لحساب مجموع المرتبات بدون استخدام الدالة sum

set serveroutput on size 20000 format wrapped
declare
x number;
y number:=0;
cursor cur_sal is select sal from emp;
begin
open cur_sal;
loop
fetch cur_sal into x;
exit when cur_sal%notfound;
y:=y+x;
end loop;
close cur_sal;
dbms_output.put_line('sum sal without using sum function = '||y);
end;




ونسالكم الدعاء

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

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

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

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

×   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.

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

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

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