you could possibly do it like this.
FOR o in SELECT distinct(col_id) as id FROM table1 JOIN table2 ON col_id = t2_t1_id WHERE CASE period_type WHEN 'CURRENT' THEN field1 IS NULL WHEN 'old' THEN field1 IS NOT NULL
...etc...
END LOOP