Re: Is there a GoTo ?

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Is there a GoTo ?
Date: 2020-01-16 16:17:13
Message-ID: 872cd0ac-1edc-2c75-290e-1ab88138684f@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 1/16/20 2:48 AM, İlyas Derse wrote:
> In this function I have to GOTO to a label1, but GOTO keyword is not
> working, can you please help me in getting the way from which I am able
> to jump from a particular code to label.
>  Thanks...
>
> |CREATEORREPLACE FUNCTIONtest(i integer)RETURNS integer
> AS$$BEGINIFi<0THENRETURNi
> +1;ELSEGOTOlabel1;ENDIF<<label1>>RETURNnull;END;$$LANGUAGE plpgsql;|
>

Are you looking for EXIT?:

https://www.postgresql.org/docs/12/plpgsql-control-structures.html#PLPGSQL-CONDITIONALS
42.6.5.2. EXIT

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Justin 2020-01-16 16:38:15 Re: Can I do this?
Previous Message Michael Nolan 2020-01-16 15:39:59 Re: Can I do this?