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

مساعدة فى حل اسئلة pl-sql


dream maker

Recommended Posts

يا جماعة ساعدوني بحلهم بليز لازمني الحل اليوم جزاكم الله الخير ساعدوني بحلهم


-Create pL\sql block to declare a cursor EMP_CUR to select the employee_id , first_name,last_name,Salary,hire_date.for all employees works in any department that is name start with ‘c’.process each row from the cursor, and if the salary greater than 15000 and hire_date is greater than 01-feb-1988 display the last_ name salary and hire_date.


2create pL\sql block to declare a cursor date_cur to select the employee_id, first_name,last_name,salary for employees whose hire_date is less than 01-mar-2000,Process each row from the cursor and if the salary is less than or equal 15000.rais an exception .handle the exception with appropriate exception handler thatinsert values into error_table: employee_id,salary.otherwise display “thank you for your effort”.
0

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

السلام عليكم أخي

حل السؤال الأول

declare 
cursor EMP_CUR is
select e.employee_id as employee_id , 
e.first_name as first_name ,
e.last_name as last_name,
e.Salary as Salary, 
e.hire_date as hire_date, 
d.department_no
from empolyees e, departments d 
where e.department_no = d.department_no
and d.department_name like 'c%';
begin
for rec_1 in emp_cur loop
if rec_1.salary > 15000 and rec_1.hire_date > to_date('01-feb-1988','dd-mon-yyyy') then
dbms_output.put_line (' Last Name ' || rec_1.last_name || ' Salary ' || 
rec_1.salary || ' Hire Date ' || rec_1.hire_date);
end if;
end loop;
end;




حل السؤال الثاني

declare 
salary_exp EXCEPTION;
cursor EMP_CUR is
select employee_id , 
first_name ,
last_name ,
Salary
from empolyees 
where hire_date < to_date('01-mar-2000','dd-mon-yyyy');
begin
for rec_1 in emp_cur loop
if rec_1.salary <= 15000 then
RAISE salary_exp;
else
dbms_output.put_line ('thank you for your effort');
end if;
end loop;
EXCEPTION
WHEN salary_exp THEN
insert into error_table (employee_id,salary) values (rec_1.employee_id, rec_1.salary);
commit;
end;

تم تعديل بواسطة ahasan
رابط هذا التعليق
شارك

مششكوووور كتتتتير اخوي
بس بدي اسال انتى متأكد من الجابة لانه كتير مهم في عندي سؤال تاني عادي اسألك اياه
يعطييييك الف عافية وما قصرت :blink:

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


مششكوووور كتتتتير اخوي
بس بدي اسال انتى متأكد من الجابة لانه كتير مهم في عندي سؤال تاني عادي اسألك اياه
يعطييييك الف عافية وما قصرت :blink:


ان شاء الله أخوي
لكن .. طبقها انت واتأكد بنفسك ... عشان تتقن كتابة الاكواد :blink:
واسال اخوي .. وان شاء الله اذا قدرت اساعدك ما بقصر معك :blink:
رابط هذا التعليق
شارك

السلام عليكم اخووي

اخوووي ... انا ان شاء الله رح احل السؤال ... بس بتمنى منك انت تحاول عشان تتقن كتابة الكود

declare
v_count number;
begin
select count(1)
into	v_count
from	from employees
where department_id = 30;
dbms_output.put_line ('The number of employees who work in department_id=30 ' || v_count);
exception
when no_data_found then
null; 
end;



بالتوفيق

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

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

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

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

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

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

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

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