FOR x IN ( SELECT COUNT(*) cnt
FROM DUAL
WHERE EXISTS ( SELECT NULL FROM task
WHERE task.task_type_id = lib.task_type_check()
AND task.task_status_id = lib.task_status_open()
AND task.unit_id = in_unit_id
AND task.station_id = v_station_id
)
)
LOOP
IF( x.cnt = 1 ) THEN
v_task_exist := TRUE;
ELSE
v_task_exist := FALSE;
END IF;
END LOOP;