-- valid.sql

CREATE TABLE pay_type_copy as
SELECT *
  FROM pay_type
/

CREATE OR REPLACE FUNCTION pay_type_count
RETURN NUMBER
AS
    ctr NUMBER;
BEGIN
    SELECT COUNT(*) INTO ctr
      FROM pay_type_copy;
    RETURN ctr;
END;
/

DECLARE
   c NUMBER;
BEGIN
   c := pay_type_count;
   DBMS_OUTPUT.PUT_LINE('The number of pay types is ' || c);
END;
/
