 as follows:      warehouse_db=# CREATE OR REPLACE FUNCTION getRecords()     RETURNS INTEGER AS $$     DECLARE       total INTEGER;     BEGIN       SELECT COUNT(*) INTO total FROM warehouse_tbl;       **IF (total > 0) THEN**     **RETURN total;**     **ELSE**     **RAISE NOTICE 'table is empty';**     **END IF;**     END;     $$ LANGUAGE plpgsql;  The result can be seen using the following statement:      warehouse_db=# SELECT getRecords();      getRecords      ------------               0      (0 row)  #