Re: [HACKERS] Nested funtion

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Sridhar N Bamandlapally <sridhar(dot)bn1(at)gmail(dot)com>
Cc: PG-General Mailing List <pgsql-general(at)postgresql(dot)org>, PostgreSQL-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] Nested funtion
Date: 2016-03-28 04:27:21
Message-ID: CAFj8pRDmmQWQGJcEJfZNRXzfF93Ug8aoP5ZMD7QVgkaeoO1oTw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Hi

2016-03-28 6:14 GMT+02:00 Sridhar N Bamandlapally <sridhar(dot)bn1(at)gmail(dot)com>:

> Hi
>
> Is there any way to create nested function?
>

Some languages supports this feature, like plv8, but plpgsql doesn't
support it,

You have to use two function and some implementation of session variables.

Regards

Pavel

>
> oracle to postgres migration required super function variable reference
> into nested function without nested function parameter
>
> Oracle sample:
> -------------------------------
> create or replace function f1(n number) return number
> is
> vs number:=1;
> function nf1(m number) return number is
> begin
> return vs + m + n;
> end;
> begin
> return nf1(2);
> end;
> /
>
> run:
> --------
> SQL> select f1(9) from dual;
>
> F1(9)
> ----------
> 12
>
>
>
> Thanks
> Sridhar BN
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2016-03-28 04:28:41 Re: Nested funtion
Previous Message Sridhar N Bamandlapally 2016-03-28 04:14:01 Nested funtion

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2016-03-28 04:28:41 Re: Nested funtion
Previous Message Sridhar N Bamandlapally 2016-03-28 04:14:01 Nested funtion