Proposal - Continue stmt for PL/pgSQL

From: Pavel Stehule <stehule(at)kix(dot)fsv(dot)cvut(dot)cz>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Proposal - Continue stmt for PL/pgSQL
Date: 2005-06-16 16:32:02
Message-ID: Pine.LNX.4.44.0506161824240.13602-100000@kix.fsv.cvut.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello

Statement CONTINUE isn't in PL/SQL too, I know it, but Oracle PL/SQL
has statement GOTO. I don't need GOTO statement, but 'continue' can be
very usefull for me. I have to do some ugly trick now. With little change,
we can enhance stmt EXIT for behavior continue.

After some work I can

CREATE OR REPLACE FUNCTION lll() RETURNS void AS $$
DECLARE i integer = 0;
BEGIN
LOOP
i = i + 1;
CONTINUE WHEN i < 10;
RAISE NOTICE '%', i;
EXIT;
END LOOP;
BEGIN
CONTINUE WHEN i = 10;
RAISE NOTICE '---1---';
END;
RAISE NOTICE '---2---';
FOR _i IN 1 .. 10 LOOP
CONTINUE WHEN _i < 5;
RAISE NOTICE '%', _i;
END LOOP;
END; $$ LANGUAGE plpgsql;
select lll();

pokus=# NOTICE: 10
NOTICE: ---2---
NOTICE: 5
NOTICE: 6
NOTICE: 7
NOTICE: 8
NOTICE: 9
NOTICE: 10
lll
-----

(1 row)

What do you think about it? It's broke PL/SQL compatibility, I know, but
via last discussion I have opinion so Oracle compatibility isn't main
objective PL/pgSQL. There is some less/bigger diferencess: SQLSTATE,
EXCEPTION from my last proposal, atd.

What do you think about it?

Regards
Pavel Stehule

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2005-06-16 16:40:16 Re: Proposal - Continue stmt for PL/pgSQL
Previous Message Douglas McNaught 2005-06-16 16:29:43 Re: Autovacuum in the backend