Thanks all,
cursor resolved this problem. I thinked that queries are rewriten into implicit cursor, so I didn't use it for query. Now I see, I was wrong.
Jirka Novak