With Oracle you need to declare all your variables at the top of the block, before the BEGIN
:
DECLARE
... variable declarations
BEGIN
... program logic
END;
Your code should go something like this:
DECLARE
v_rownum number;
CURSOR v_donvi IS
SELECT * FROM whatever;
... any other declarations
BEGIN
FOR donvi_rows IN v_donvi
LOOP
SELECT r
INTO v_rownum
FROM (
SELECT ROWNUM AS r, k.Id
FROM don_vi k
WHERE k.ParentId = 1
)
WHERE Id = donvi_rows.Id;
END LOOP;
END;