DROP FUNCTION IF EXISTS gtcnadaconsta(integer);
CREATE OR REPLACE FUNCTION gtcnadaconsta(person bigint)
  RETURNS boolean AS
$BODY$
DECLARE
    v_result boolean;
BEGIN
    SELECT into v_result SUM(quantidade) = 0 FROM gtcObterRestricoes(person);
    
    RETURN v_result;
END; 
$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;
ALTER FUNCTION gtcnadaconsta(bigint)
  OWNER TO postgres;

