Proposal - Continue stmt for PL/pgSQL - Mailing list pgsql-hackers

From Pavel Stehule
Subject Proposal - Continue stmt for PL/pgSQL
Date
Msg-id Pine.LNX.4.44.0506161824240.13602-100000@kix.fsv.cvut.cz
Whole thread Raw
Responses Re: Proposal - Continue stmt for PL/pgSQL
Re: Proposal - Continue stmt for PL/pgSQL
Re: Proposal - Continue stmt for PL/pgSQL
List 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:  10lll
-----

(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




pgsql-hackers by date:

Previous
From: Josh Berkus
Date:
Subject: Re: Autovacuum in the backend
Next
From: Douglas McNaught
Date:
Subject: Re: Autovacuum in the backend