viernes, 8 de junio de 2012

Package

create or replace package MiPrimerPaquete is --creamos el encabezado
  FUNCTION CUENTAEMPLEADOS(pDepto in employees.department_id%type) return number;
end MiPrimerPaquete;


create or replace package body MiPrimerPaquete is
function CUENTAEMPLEADOS(pDepto IN employees.department_id%type)  
RETURN NUMBER AS
totalEmpleados integer;
begin
    select count(*) into totalEmpleados
    from Employees
    where department_id = pDepto;
    RETURN totalEmpleados;
  end CUENTAEMPLEADOS;
end MiPrimerPaquete;

select MiPrimerPaquete.CUENTAEMPLEADOS(90) FROM DUAL;

No hay comentarios:

Publicar un comentario