الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

مساعدة في Function

بدأه رنا**رنا في 12 أبريل 2008 · 3 رد · 1,878 مشاهدة · في قسم لغةالاجرائات Pl/sql
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم

عندي مشكلة في برنامج عن الfunction

ياريت تساعدوني انا عندي السؤال بس في شغلات بالسؤال مش فاهماها

وحاولت احله

راح اكتب السؤال اول شي

create a function called annual to return annual salary by passing two parameters(one for monthly salary and second for commision )

either or both values passed can be null, but the function should still return an annual salary which is not null

the annual salary = (salary*12) +(commission *salary*12)

انا حليت السؤال زي مافهمت بس مافهمت ايش المقصود هنا ايش نعمل بالnull


begin
return(emp_sal*12)+(emp_comm*emp_sal*12);
end annual_comp;
create or replace function annual_comp (emp_sal employees.salary%type, emp_comm number)return number is

ياريت تساعدوني

شكرا الكم

#2

ماحدا بيقدر يساعدني

:S

#3

هذا هو كود الدالة :

create or replace function annual_salary(emp_sal number , emp_comm number)return number is   
m number;
begin
m := (nvl(emp_sal , 0)*12) + nvl(emp_comm , 0);
return m;
end;

وهذا اختبار للدالة :

select (nvl(salary , 0)*12) + nvl(commission_pct , 0) , annual_salary(salary , commission_pct)
 from employees;

تم تعديل هذه المشاركة بواسطة hany aldesouky في 5 مايو 2008 في 01:29

#4

الاخت رنا

على قدر علمى هذا هو الكود المطابق لسؤالك

create or replace function annual_comp (emp_sal employees.salary%type, emp_comm number)return number is

net_sal number;

m number;

n number;

begin

m:=(nvl(emp_sal,0)*12);

n:=(nvl(emp_comm,0)*m);

net_sal:= m + n;

return net_sal;

end annual_comp;


﴿وَمَا كَانَ اللَّهُ لِيُعَذِّبَهُمْ وَأَنْتَ فِيهِمْ ۚ وَمَا كَانَ اللَّهُ مُعَذِّبَهُمْ وَهُمْ يَسْتَغْفِرُونَ﴾

الأنفال ۳۳                                  
 

مواضيع مشابهة