بتاريخ: 19 مارس 200520 سنة comment_30071 سؤال في (الاستناء) exception ا رجو الاجابة عليه بأسرع وقت ممكن مطلوب برنامج لاستراجاع اسم الموظف صاحب راتب معين 1-اذا الراتب المدخل تسبب في استرجاع اكثر من سطر عالج الاستناء الناتج بالمعالج المناسب وادرج في جدول messages الرسالة "هناك اكثر من موظف لهم راتب (salary) 2-اذا الراتب المدخل لم يسترجع اي سطر عالج الاستثناء الناتج بالمعالج المناسب وادرج في جدول messages الرسالة "لايوجد موظفون لهم رواتب (salary) 3-اذا الراتب المدخل يسترجع سطرا واحد فقط ادرج في جدول messages الرسالة "اسم الموظف وراتبه 4-عالج اي استثناء اخر بالمعالج المناسب وادرج في جدول messages الرسالة "حدث هناك خطأ ما" 5-قم بتجريب الحالات المختلفة في البرنامج المكتوب وتفحص محتويات الجدول messages RESULTS محمد - 2000 هناك اكثر من موظف له راتب 500 لايوجد موظفون لهم رواتب 3500 تم تعديل 19 مارس 200520 سنة بواسطة koi تقديم بلاغ
بتاريخ: 19 مارس 200520 سنة comment_30080 declare v_sal emp.sal%type; v_name emp.ename%type; v_value messages.results%type; begin select ename into v_name from emp where sal=800; v_value := v_name||800; insert into messages values(v_value); commit; exception when too_many_rows then begin v_value := 'there are more than one emp take this salary '||800; insert into messages values(v_value); commit; end; when no_data_found then begin v_value := 'No emp take this salary = '|| 800; insert into messages values(v_value); commit; end; when others then begin v_value := 'there are an error'; insert into messages values(v_value); commit; end; end; SQL> select * from messages; RESULTS ---------------------------------------------------------------------------------------------------- there are more than one emp take this salary 3000 No emp take this salary = 500 SMITH800 3 rows selected. SQL> ارجو ان يكون اجتهادي صايبا ولا تنسانا من دعواتكوان اردت باقي الاسئله اخبرني وشكرا لك تم تعديل 19 مارس 200520 سنة بواسطة تركي936 تقديم بلاغ
بتاريخ: 19 مارس 200520 سنة كاتب الموضوع comment_30085 مشكور اخوي اذا في اجابات ثانية ارجوا ان تعطوني اياهاوشكرا تقديم بلاغ
بتاريخ: 22 مارس 200520 سنة comment_30539 السلام عليكم أحببت أن أضع طلبك في procedure ولكن لاأظن أنه من الضروري أن نضع النتائج في table SQL> create or replace procedure empsal (p_sal in out number ) 2 is 3 v_ename varchar2(20) ; 4 begin 5 select sal,ename 6 into p_sal,v_ename 7 from emp 8 where sal=p_sal ; 9 dbms_output.put_line(p_sal||'>>>>>>>>>'||v_ename); 10 insert into empsal1 11 values 12 (v_ename,p_sal,sysdate); 13 commit ; 14 exception when no_data_found then 15 insert into empsal1 16 values 17 ('no emp with this sal',p_sal,sysdate); 18 when too_many_rows then 19 insert into empsal1 20 values 21 ('there is more than emp with this sal',p_sal,sysdate); 22 when others then 23 dbms_output.put_line ('********other error********'); 24 end; 25 /Procedure created.SQL> select * from empsal1;no rows selectedSQL> var x numberSQL> begin 2 :x:=5000; 3 end; 4 /PL/SQL procedure successfully completed.SQL> exec empsal(:x);5000>>>>>>>>>KINGPL/SQL procedure successfully completed.SQL> select * from empsal1;NAME----------------------------------------------------------------------------------- SAL TIME---------- ---------KING 5000 22-MAR-05SQL> var x numberSQL> begin 2 :x:=525; 3 end; 4 /PL/SQL procedure successfully completed.SQL> exec empsal(:x);PL/SQL procedure successfully completed.SQL> select * from empsal1;NAME----------------------------------------------------------------------------------- SAL TIME---------- ---------KING 5000 22-MAR-05no emp with this sal 525 22-MAR-05SQL> var x numberSQL> begin 2 :x:=3000; 3 end; 4 /PL/SQL procedure successfully completed.SQL> select * from empsal1;NAME----------------------------------------------------------------------------------- SAL TIME---------- ---------KING 5000 22-MAR-05no emp with this sal 525 22-MAR-05SQL> exec empsal(:x);PL/SQL procedure successfully completed.SQL> select * from empsal1;NAME----------------------------------------------------------------------------------- SAL TIME---------- ---------there is more than emp with this sal 3000 22-MAR-05KING 5000 22-MAR-05no emp with this sal 525 22-MAR-05 تقديم بلاغ
بتاريخ: 5 أبريل 200520 سنة comment_32107 السلام عليكم ورحمة الله وبركاته،، أتمني أن تفيدك إجابتي :exception when too_many_rows then dbms_output.put_line ('there are many employees have this salary')return 'there are many employees have this salary' ;when no_data_found then dbms_output.put_line ('there is no employee have this salary');return 'there is no employee have this salary';when others then dbms_output.put_line ('unknown error')return 'unknown error'; تقديم بلاغ
انضم إلى المناقشة
يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.