بتاريخ: 21 أبريل 200719 سنة comment_97619 لسلام عليكمحاولت بطرق كثيره لاتوصل للحل ولم اقدر اجيدهوكتبت هذا الكود ولكن ماالخطا فيه DECLARE ENO NUMBER(4); BEGIN ENO:=&ENO; SELECT * FROM EMP WHERE ENO=EMPNO; end; / بس ماضبط معي فايش الخطاالسوالمن خلال ال PL/SQLاريد فقط ادخال رقم الموظف EMPNO للجدول EMP وبمجرد ادخال رقم الموظف فيعطيني كل تفاصيل الموظف اي الصف كامل JOB,SAL,DEPTNO,ENAME,HIREDATE والى اخرهولكم الجزيل الشكر تم تعديل 21 أبريل 200719 سنة بواسطة abdullah_hamad تقديم بلاغ
بتاريخ: 21 أبريل 200719 سنة comment_97627 set serveroutput on DECLARE ENO NUMBER(4); v_ename varchar2(20); BEGIN ENO:=&ENO; SELECT ename into v_ename FROM EMP WHERE ENO=EMPNO; end; طبعا يحتاجلك ان تستخدم البكج dbms_output.put_line () لكي تعرض النتائج على sql*plus تقديم بلاغ
بتاريخ: 22 أبريل 200719 سنة comment_97701 alsalam alekom as i understand quation i think that u shoud use cursor to display all employee detail u have employee table which contain such as 5 columns so u want to see the 5 columnsname of columns is empno ,ename,sal,job,comm then can see this all columns as below by using pl sql ed first.sqldeclare cursor c1 is select *from emp;er emp%rewtype;Beginopen c1loopfetch c1 into er from emp where empno=en;exit when c1%notfound;dbms_output.put_line(er.empno||' '||er.ename ||' ' ||er.sal||' '||and so on)end loop;close c1;end ;/go to sql and use @first.sqlin my dbms i used and so on means remaining of columns [/u] or u can use another way declare cursor c1 is select empno ,ename ,sal,job,comm from emp;no emp.empno%type;en emp.ename%type;es emp.sal%type;ej emp.job%type;ec emp.comm%type;Beginopen c1loopfetch c1 into no,en,es,ej,ec from emp where empno=no;exit when c1%notfound;dbms_output.put_line(er.empno||' '||er.ename ||' ' ||er.sal||' '||and so on)end loop;close c1;end ;/ تقديم بلاغ
انضم إلى المناقشة
يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.