My example wasn't complete. You need to wrap the cursor calls in BEGINand END. Read the DECLARE docs for the minutiae.
/Steve