Using cursors for database query

example1 shows how to use cursors in an interactive query program. The program: