بتاريخ: 23 مارس 201016 سنة comment_188070 مرحبا باخواني الاعزاء وبعد :ارجو المساعدة بحل السؤال التالي :اكتب Procedure لاسترجاع معدل الراتب السنوي وأعلى راتب سنوي وأقل راتب سنوي لموظفي القسم المدخل رقمها ........(يعني لما ندخل اي رقم موظف من جدول emp يعطينا معدل الراتب السنوي له و أعلى راتب سنوي وأقل راتب سنوي ) ... هكذا.....ارجو الرد ؟؟؟؟؟؟ مشكوورين تقديم بلاغ
بتاريخ: 23 مارس 201016 سنة comment_188104 مش عارفة حضرتك مدخل الدنيا ف بعضها او انا مافهمتش اصد حضرتك يعنى مثلا تقول بروسيدر ترجع اعلى راتب سنوى واقل راتب سنوى للموظفين ال ف قسم معين .. بس حضرتك بعدها دخلت الموظف ورقمه وحوار create or replace procedure pro_emp(dept_no emp.deptno%type) is cursor emp_cr is select max((sal*12) +nvl(comm,0)*12) maxsal ,min((sal*12) +nvl(comm,0)*12) minsal from emp where deptno=dept_no; max_sal emp.sal%type; min_sal emp.sal%type; begin open emp_cr ; loop fetch emp_cr into max_sal,min_sal; exit when emp_cr%notfound; dbms_output.put_line('maxsalary is' || max_sal || ' ' || 'minsalary' || ' ' || min_sal); end loop; end; تقديم بلاغ
بتاريخ: 26 مارس 201016 سنة comment_188299 الأخ العزيز الإجابة كما يلي create or replace procedure sal_info (p_deptno in number, p_year_maxsal out number, p_year_minsal out number, p_year_avgsal out number) is begin select max(sal*12) ,min(sal*12),round(avg(sal*12),0) into p_year_maxsal , p_year_minsal ,p_year_avgsal from emp group by p_deptno; end; ثم نبدء بالتنفيذ كما يلي set serveroutput on; declare v_max number; v_min number; v_avg number; begin sal_info (10,v_max,v_min ,v_avg); dbms_output.put_line(v_max||' '||v_min||' '||v_avg); end; مع تمنياتي لك بالتوفيق تقديم بلاغ
بتاريخ: 26 مارس 201016 سنة comment_188326 انا بصراحة كل اللى فهمتة انك عايز تدخل رقم الموظف يرجعلك مرتبة السنوى واعلى مرتب سنوى لنفس الادرارة اللى بيشتغل فيها الموظف واقل مرتب سنوى لنفس الادارة برضويا رب اكون فهمت صحcreate or replace procedure emp_sal(emp_id emp_no.emp%type)iscursor c1 is select dept_no from emp where emp_no=emp_id;cursor c2 is select (nvl(sal*12,0))+(nvl(comm*12,0)) from emp where emp_no=emp_id;cursor c3 is select nvl(max(sal*12),0),nvl(min(sal*12),0) from emp where dept_no=h group by dept_no;h number;x number;y number;z number;begin------- to get the department number into h-------------open c1;fetch c1 into h;close c1;------ to get the annual salary for the employee-----open c2;fetch c2 into x;close c2;-------- to get the max and the min annual salary for the same employee department -------open c3;fetch c3 into y,z;close c3;dbms_output.put_line( x || ' ' ||y||' '||z);end; تقديم بلاغ
بتاريخ: 27 مارس 201016 سنة comment_188386 ^^^^^^^^الاخ shaldum ... أحببت ان اضع اجابتك على هذا النحو .. لكي يستطيع الاخرون قراءتها بسهولة . اعتذر منك create or replace procedure emp_sal(emp_id emp_no.emp%type) is cursor c1 is select dept_no from emp where emp_no=emp_id; cursor c2 is select (nvl(sal*12,0))+(nvl(comm*12,0)) from emp where emp_no=emp_id; cursor c3 is select nvl(max(sal*12),0),nvl(min(sal*12),0) from emp where dept_no=h group by dept_no; h number; x number; y number; z number; begin ------- to get the department number into h------------- open c1; fetch c1 into h; close c1; ------ to get the annual salary for the employee----- open c2; fetch c2 into x; close c2; -------- to get the max and the min annual salary for the same employee department ------- open c3; fetch c3 into y,z; close c3; dbms_output.put_line( x || ' ' ||y||' '||z); end تقديم بلاغ
انضم إلى المناقشة
يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.