The document contains PL/SQL code that uses two cursors to loop through department and employee data from tables and output the results. The inner cursor is parameterized by the department number from the outer cursor. Information about each department and employees in that department are formatted and output.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
5 views1 page
Seance 4
The document contains PL/SQL code that uses two cursors to loop through department and employee data from tables and output the results. The inner cursor is parameterized by the department number from the outer cursor. Information about each department and employees in that department are formatted and output.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1
***********
ex4 serie2 ***********
set serveroutput on;
declare cursor c1 is select deptno,dname from dept; cursor c2(v_deptno dept.deptno %type) is select ename,job,sal,comm from emp where deptno=v_deptno; begin for rec in c1 loop
for rec2 in c2(rec.deptno)
loop if c2 %rowcount = 1 then dbms_output.put_line('*********************************************************'); dbms_output.put_line('departement'||lpad(rec.dname,12)); dbms_output.put_line('*********************************************************'); dbms_output.put_line(rpad('NomDeLEmploye',15)||rpad('Fonction',15)|| rpad('Salaire',15)||rpad('Commission',15)); end if; dbms_output.put_line(rpad(rec2.ename,15)||rpad(rec2.job,15)||rpad(rec2.sal,15)|| rpad(rec2.comm,15)); end loop; end loop; end;