-- count-empls-proc.sql
-- last modified: 1-28-13
--
-- note: uses table from set-up-ex-tbls.sql

--------
-- signature: procedure: count_empls: void -> void
-- purpose: expects nothing, returns nothing, prints to the screen
--     how many rows are currently in the empl table
-- example:
--     If empl currently has 14 rows, and you call from sqlplus:
--     exec count_empls
--     and if you have set serveroutput on, then you should see:
-- There are currently 14 employee(s).
--------

create or replace procedure count_empls is
    num_empls integer;
begin
    select count(*)
    into num_empls
    from empl;

    dbms_output.put_line('There are currently ' || num_empls ||
                         ' employee(s).');
end;
/
show errors

set serveroutput on
prompt "================================"
prompt "TESTING count_empls; should see a 14-employees message"
prompt "================================"
exec count_empls

-- end of count-empls-proc.sql