database query test with database function query and fetch