create or replace procedure p_reporte_personal_c (cod in number

)
is
x employees%rowtype;
NOMBRED VARCHAR2(25);
nombrec VARCHAR2(25);
APELLIDO VARCHAR2(25);
nombre VARCHAR2(25);
y number;
CODIGO NUMBER;
CURSOR CURSORX IS
SELECT employee_id, last_name, first_name FROM employees
WHERE manager_id=X.EMPLOYEE_ID;
begin
select count(distinct(manager_id)) into y from employees
where manager_id is not null AND manager_id=cod;
IF y=1 THEN
SELECT * into x FROM employees where employee_id=cod;
SELECT d.department_name into nombred FROM departments d
WHERE d.department_id=x.department_id;
SELECT job_title into nombrec FROM jobs
WHERE job_id=x.job_id;
DBMS_OUTPUT.PUT_LINE('****** Reporte personal asignado *****');
DBMS_OUTPUT.PUT_LINE('NOMBRE Y APELLIDO: ' || X.FIRST_NAME||' '||x.LAST_NAME);
DBMS_OUTPUT.PUT_LINE('NOMBRE DEPARTAMENTO: ' ||nombred);
DBMS_OUTPUT.PUT_LINE('NOMBRE CARGO: ' || nombrec);
DBMS_OUTPUT.PUT_LINE('PERSONAL A CARGO: ');
DBMS_OUTPUT.PUT_LINE(' CODIGO APELLIDO
NOMBRE');
OPEN CURSORX;
LOOP
FETCH CURSORX INTO CODIGO, APELLIDO, nombre;
EXIT WHEN CURSORX%NOTFOUND;
DBMS_OUTPUT.PUT_LINE('
'||rpad(COD,7,' ')||rpad(APELLIDO,12,' ')||nombre);
END LOOP;
DBMS_OUTPUT.PUT_LINE('TOTAL PERSONAL: '||CURSORX%ROWCOUNT);
CLOSE CURSORX;
ELSE
SELECT * into x FROM employees where employee_id=cod;
SELECT d.department_name into nombred FROM departments d
WHERE d.department_id=x.department_id;
SELECT job_title into nombrec FROM jobs
WHERE job_id=x.job_id;
DBMS_OUTPUT.PUT_LINE('****** Reporte personal asignado *****');
DBMS_OUTPUT.PUT_LINE('NOMBRE Y APELLIDO: ' || X.FIRST_NAME||' '||x.LAST_NAME);
DBMS_OUTPUT.PUT_LINE('NOMBRE DEPARTAMENTO: ' ||nombred);
DBMS_OUTPUT.PUT_LINE('NOMBRE CARGO: ' || nombrec);
DBMS_OUTPUT.PUT_LINE('PERSONAL A CARGO: No tiene personal a cargo');
END IF;
END p_reporte_personal_c;
*******************************************************
create or replace PROCEDURE p_personal_cargo (cod in number)
AS
cursor personal_c is
SELECT EMPLOYEE_ID, FIRST_NAME, LAST_NAME FROM employees
WHERE manager_id=COD;
begin
DBMS_OUTPUT.PUT_LINE('***********************************************');
FOR x IN personal_c LOOP

p_personal_cargo(cod).' ')).salary.last_name). . sueldot employees. begin select * into emp from employees where employee_id=cod.PUT_LINE('NOMBRE COMPLETO: '||emp. DBMS_OUTPUT.' ')||x.pe'). DBMS_OUTPUT. DBMS_OUTPUT.email)||'@uigv.edu.hire_date.PUT_LINE(' SUELDO '||' COMISION').PUT_LINE(' '||RPAD(x. end p_reporte.10.PUT_LINE('***********************************************').PUT_LINE('FECHA DE CONTRATO: '||rpad(TO_CHAR(emp. DDMON-YYYY'). 'DY. DBMS_OUTPUT.PUT_LINE('NOMBRE DEPARTAMENTO: '||upper(nombred)).salary%TYPE.10.999. DBMS_OUTPUT.employee_id).department_id = d. nombred departments.PUT_LINE('************** REPORTE EMPLEADO ***************').25. 'DY.department_name%TYPE. DBMS_OUTPUT.commission_pct.PUT_LINE('FECHA: '||TO_CHAR(SYSDATE. select department_name into nombred from employees e. DBMS_OUTPUT.salary*emp. sueldot:=bono+emp. departments d where e. ********************************************************* create or replace procedure p_reporte(cod in number) as emp employees%ROWTYPE.PUT_LINE('PERSONAL A CARGO: ').999. DBMS_OUTPUT.DBMS_OUTPUT.PUT_LINE('REPORTE REALIZADO POR MARCO CORAL'). DBMS_OUTPUT. valor number.99')||lpad(TO_CHAR(emp.first_name||' '||emp. DBMS_OUTPUT. nombre varchar2(50). bono employees.first_name).PUT_LINE('CORREO ELECTRONICO: '||lower(emp.99').PUT_LINE('CODIGO EMPLEADO: '||emp.' ')). '$99 9.department_id and e.salary. codigo number. END LOOP.employee_id=cod. '$999. bono:=emp. end p_personal_cargo. DBMS_OUTPUT.salary%TYPE.EMPLOYEE_ID. DBMS_OUTPUT. DD-MON-YYYY')).PUT_LINE(TO_CHAR(bono.