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

ساعدونا وبنساعدكم


الورد1

Recommended Posts

هلا وغلا :D :rolleyes:
ممكن حد يشرحلي هالسؤال مع الحل واكون ممنونه له بطول فتره دراستي

Question 1: Create a PL/SQL block that will accept a number from the user. The block will call


a procedure that will display in the screen all the “ODD” numbers from 1 until the given number
by the user and total number of “ODD” numbers. (5 marks)
Example: if the user enters 5, then the output that will be 1,3,5 and total is 3.
Note: You have to create both the PL/SQL block that will call a procedure and the procedure
itself.
Question 2

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

السلام عليكم.

ال procedure هو كالآتي:

create procedure get_odd(top number)
is
counter number(10):=0;
total number(5):=0;
begin loop
if mod(counter,2)<>0
then
dbms_output.put_line(counter);
total:=total+1;
end if;
counter:=counter+1;
exit when counter>top;
end loop;
dbms_output.put_line('The tatal is '||total);
end;



أما ال pl/sql block هو:


begin get_odd(&the_given_number);
end;

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

Example: if the user enters 5, then the output that will be 1,3,5 and total is 3.


الواضح من السؤال أنه إذا تم إدخال الرقم (5) فإن الناتج يكون (1,3,5) ومجموع عدد هذا الناتج هو ثلاثة أرقام. المقصود بالمجموع هو عدد النواتج من هذه العمليه وليس العدد الذي أدخله المستخدم (هذا ما فهمته من الtask)، وهذا هو ما يقوم به الإجراء السابق. أما إذا كان لكي رأي آخر أو أردتي عمل تعديل معين فأخبريني به.
رابط هذا التعليق
شارك

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

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

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

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

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

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

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