example of using cursor