Cursor loop - stop current iteration and continue with next iteration

From: Dinesh Kumara <dinesh(at)rezgateway(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Cursor loop - stop current iteration and continue with next iteration
Date: 2011-12-21 05:36:25
Message-ID: 4EF17059.9020807@rezgateway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Greetings..

Please advice me how to stop current iteration of cursor loop and
continue with next iteration .

...
contractlistquery = '....';
OPEN rec_contractlist FOR EXECUTE contractlistquery;
LOOP
FETCH rec_contractlist INTO
contract_from_date,contract_to_date,contract_inv_type,contract_regionid;
IF NOT FOUND THEN
EXIT;
END IF;

IF contract_count = 0 THEN
contract_initial_region = contract_regionid;
END IF;

IF contract_initial_region <> contract_regionid THEN
[Need to stop current iteration and continue with next iteration.]
ELSE
...
More logic s here...
...
END IF;

END LOOP;
CLOSE rec_contractlist;
...

Really appreciate if you can help me on this.
--

*Thanks and Regards,*
Dinesh Kumara,
Software Engineer,
Reservation Gateway Inc,
Email:dinesh(at)rezgateway(dot)com <mailto:dinesh(at)rezgateway(dot)com>
www.rezgateway.com

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alban Hertroys 2011-12-21 07:53:17 Re: design help for performance
Previous Message Tom Lane 2011-12-21 01:16:35 Re: out of memory error with loading pg_dumpall