الانتقال إلى المحتوى
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.

ارجوا المساعده فى هذا الكود

Featured Replies

بتاريخ:

السلام عليكم ورحمة الله وبركاتة

انا عندى 3 جداول من ضمنهم جدولين مربوطين ببعض والثالث منفصل وقمت بعمل بروسيدجر للقيام بعملية حساب احمالى مرتب الموطفين و وضعهم فى الجدول الثالث
عند تنفيذ الامر يقوم بحساب فرد واحد فقط

(# تعنى انها مفتاح رئيسى)

tables
-----
table employeees
emp_id#
emp_name
basic_salary
commision_percent
---------------------
table monthly_sales
month#
year#
emp_id#
total_sales
------------------
table salary
emp_id#
month#
year#
basic_salary
commision_amount
total_salary

احتساب قيمة العمولة = اجمالى المبيعات الشهرية * نسبة عمولة الموظف
اجمالى راتب الشهر = الرتب الاساسى + قيمة العمولة

وقمت بكتابة الكود التالى ولم يقم بحساب الا فرد واحد فقط
-----------------------------------------------
create or replace procedure total_salary is

v_emp_id varchar2(10) ;
v_basic_salary number(7,3);
v_commision_percent number (7,3);
v_total_sales number (9,3);
v_commision_amount number(9,3);
v_total_salary number (7,3);
v_month number (2) ;
v_year number (4);
------------------------------
cursor employees is
select emp_id ,basic_salary , commision_percent
from employees ;
-------------------------------
cursor monthly_sales is
select month,year,total_sales
from monthly_sales
where emp_id = v_emp_id ;
---------------------------------
begin
open employees ;
loop
fetch employees into v_emp_id ,v_basic_salary,v_commision_percent ;
exit when employees%notfound ;
end loop ;
close employees ;
-------------------------------
open monthly_sales ;
loop
fetch monthly_sales into v_month,v_year ,v_total_sales ;
exit when monthly_sales%notfound ;
end loop ;
close monthly_sales ;
--------------------------------------
v_commision_amount := (v_total_sales * v_commision_percent)/100 ;
v_total_salary := v_basic_salary + v_commision_amount;
------------------------------------
insert into salary
(emp_id,month,year,commision_amount,total_salary,basic_salary)
values
(v_emp_id,v_month,v_year,v_commision_amount,v_total_salary,v_basic_salary);

end total_salary ;

بتاريخ:

هذا الكود يحتسب للموظف الأخير بالجدول فقط
يجب اتباع الطريفة التالية

create or replace procedure total_salary is
cursor employees is
select emp_id ,basic_salary , commision_percent
from employees ;

cursor monthly_sales (v_emp_id varchar2) is
select month,year,total_sales
from monthly_sales
where emp_id = v_emp_id ;
BEGIN
for e1 in cursor_employees loop
for e2 in monthly_sales (e1.emp_id) loop
insert into salary
(emp_id,month,year,commision_amount,total_salary,basic_salary)
values
(e1.emp_id,e2.month,e2.year,(e1.total_sales * e2.commision_percent)/100,e1.basic_salary + (e1.total_sales * e2.commision_percent)/100,e1.basic_salary);
end loop;
end loop;
commit;
end total_salary

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

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

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

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

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

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.