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

بتاريخ:

بسم الله الرحمن الرحيم

اخوني الاحباء هل ممكن ششرح الكودات الاتية بالتفصيل ولكم جزل الشكر والتقدير

declare
 cursor cur3 is select *from emp;
 cursor cur4 is select* from dept;
begin
for m in cur3 loop
 for n in cur4 loop
 if m.deptno=n.deptno and m.job='ANALYST' then
 dbms_output.put_line(m.empno||'    '||m.ename||'    '||n.dname||'    '||n.loc);
 end if;
 end loop;
end loop;
end;
/






declare
 cursor cur1 is select empno,ename,job,sal,comm from emp where job='&job';
 emprec cur1%rowtype;
 cnt number;
begin
 open cur1;
 loop
    fetch cur1 into emprec;
    exit when cur1%notfound;
    insert into emp_dup(eno,ename,design,pay,comm) values(emprec.empno,emprec.ename,emprec.job,emprec.sal,emprec.comm);
 end loop;
 commit;
 cnt:=cur1%rowcount;
 close cur1;
 if cnt=0 then
 raise_application_error(-20010,'SORRY NO JOB WITH THIS NAME');
 else
 dbms_output.put_line(cnt||'  are inserted into the emp_dup table');
 end if;
 exception
 when dup_val_on_index then
 dbms_output.put_line('constraints are imposed on emp_dup table');
 end;
/
    --------------------------------------------------------------------
--cursor to retrieve the records from emp,dept and insert into emp_dept_dup
declare
 cursor cur1 is select empno,ename,job,hiredate,sal,comm,sal+nvl(comm,0),dname,loc from emp,dept where emp.deptno=dept.deptno;
 e_d_r cur1%rowtype;
begin
 open cur1;
   loop
  fetch cur1 into e_d_r;
  exit when cur1%notfound;
  insert into emp_dept_dup values(e_d_r.empno,e_d_r.ename,e_d_r.job,e_d_r.hiredate,e_d_r.sal,e_d_r.comm,e_d_r.sal+nvl(e_d_r.comm,0),e_d_r.dname,e_d_r.loc);
   end loop;
   commit;
   close cur1;
end;
/







 cursor mycur1 is select * from emp where deptno=10 for update of sal nowait;
 myrec emp%rowtype;
begin
 open mycur1;
 loop
   fetch mycur1 into myrec;
   if myrec.job='MANAGER' then
  update emp set sal=sal+100 where job='MANAGER';
  commit;
   end if;
   exit when mycur1%notfound;
 end loop;
 dbms_output.put_line('No of Record updated: '||mycur1%rowcount);
 close mycur1;
end;
/









declare
 cursor mycur1 is select * from emp where deptno=&deptno;
 emprec emp%rowtype;
 s number:=0;
 a number;
 cnt number;
begin
 open mycur1;
 loop
	  fetch mycur1 into emprec;
	  exit when mycur1%notfound;
	  dbms_output.put_line(emprec.empno||'  '||emprec.ename||'  '||emprec.sal);
	  s:=s+emprec.sal;
   end loop;
   cnt:=mycur1%rowcount;
   close mycur1;
   if cnt=0 then
   raise_application_error(-20010,'SORRY NO DEPTNO EXIST');
   else
   dbms_output.put_line('Sum of salary  : '|| s);
  a:=trunc(s/cnt,0);
  dbms_output.put_line('Average of salary : '||a);
   end if;
end;
/





   cursor cur1 is select * from emp;
   cursor cur2 is select * from dept;
   emprec emp%rowtype;
   deptrec dept%rowtype;
begin
   open cur1;
   loop
	  fetch cur1 into emprec;
	  exit when cur1%notfound;
	  dbms_output.put(emprec.empno||'  '||emprec.ename||'  '||emprec.sal);
	  open cur2;
	  loop
		    fetch cur2 into deptrec;
		    exit when cur2%notfound;
				    if emprec.deptno=deptrec.deptno then
				    dbms_output.put_line('  '||deptrec.dname||'    '||deptrec.loc);
				    end if;
	  end loop;
	  close cur2;
   end loop;
   close cur1;
end;
/

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

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

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

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

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

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.