FOR UPDATE NOWAIT ; --if this statement raises or in general if there is any error, then exception will get raised in your code for no data found or e_locked and then rollback all DML changes what ever has happened after the last commit.
I believe there should be some DML in your code.. like insert/update/delete/merge...did you remove them before posting here.