Re: Can we use sql language to create a function in Postgres?

From: Ray O'Donnell <ray(at)rodonnell(dot)ie>
To: Shaozhong SHI <shishaozhong(at)gmail(dot)com>, pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Can we use sql language to create a function in Postgres?
Date: 2022-01-05 11:10:02
Message-ID: ef205ba5-232e-3e67-1efb-27c6fd1bf591@rodonnell.ie
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 05/01/2022 11:08, Ray O'Donnell wrote:
> On 05/01/2022 11:04, Shaozhong SHI wrote:
>> I was given an Oracle script.  Can we use sql language to create a
>> function in Postgres?
>
> Yes, absolutely:
>
> create function my_function(...)
> as
> $$
>   select.....
> $$
> language sql;

Should have added the link to the docs:

https://www.postgresql.org/docs/14/server-programming.html

Ray.

--
Raymond O'Donnell // Galway // Ireland
ray(at)rodonnell(dot)ie

In response to

Browse pgsql-general by date

  From Date Subject
Next Message hubert depesz lubaczewski 2022-01-05 11:12:59 Re: Can we use sql language to create a function in Postgres?
Previous Message Ray O'Donnell 2022-01-05 11:08:42 Re: Can we use sql language to create a function in Postgres?