The TopCustomerValue procedure uses a cursor on a SELECT statement and is based on the same query used in the ListCustomerValue procedure .
See SQL Anywhere Server - SQL Usage > Stored Procedures and Triggers > Using procedures, triggers, and batches > Using cursors in procedures and triggers > Using cursors on SELECT statements in procedures.