Re: PL/pgSQL 'i = i + 1' Syntax - Mailing list pgsql-hackers

From David Wheeler
Subject Re: PL/pgSQL 'i = i + 1' Syntax
Date
Msg-id 252AC17D-1F64-4BE4-8DCE-ACACA261CF5B@kineticode.com
Whole thread Raw
In response to Re: PL/pgSQL 'i = i + 1' Syntax  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: PL/pgSQL 'i = i + 1' Syntax
List pgsql-hackers
On May 16, 2006, at 16:30, Andrew Dunstan wrote:

> It ought to be illegal to modify the loop control variable anyway,  
> IMNSHO - it certainly is in Ada, the distant antecedent of pl/pgsql.

I agree, but I must say that it's incredibly useful to be able to  
increment by two as I go through a loop:
    FOR i IN 1 + offset .. 11 + offset LOOP        total := total + substring(ean, i, 1)::INTEGER;        i = i + 1;
ENDLOOP;
 

Best,

David


pgsql-hackers by date:

Previous
From: Mark Dilger
Date:
Subject: Re: PL/pgSQL 'i = i + 1' Syntax
Next
From: Mark Dilger
Date:
Subject: Re: PL/pgSQL 'i = i + 1' Syntax