pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ray O'Donnell <ray@rodonnell.ie>
To: Shaozhong SHI <shishaozhong@gmail.com>
To: pgsql-general <pgsql-general@lists.postgresql.org>
Subject: Re: Can we use sql language to create a function in Postgres?
Date: Wed, 5 Jan 2022 11:10:02 +0000
Message-ID: <ef205ba5-232e-3e67-1efb-27c6fd1bf591@rodonnell.ie> (raw)
In-Reply-To: <3716cb3b-21e9-a204-1b2c-37a4f023c72f@rodonnell.ie>
References: <CA+i5JwaqmXc1KWVORo0xpSO0wb8tMfrFEojxV08gnR6Jb5FLyw@mail.gmail.com>
	<3716cb3b-21e9-a204-1b2c-37a4f023c72f@rodonnell.ie>

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@rodonnell.ie





view thread (8+ messages)  latest in thread

Message-ID: <ef205ba5-232e-3e67-1efb-27c6fd1bf591@rodonnell.ie>
Permalink:  ../ef205ba5-232e-3e67-1efb-27c6fd1bf591@rodonnell.ie/
Also on:    postgresql.org/message-id/ef205ba5-232e-3e67-1efb-27c6fd1bf591@rodonnell.ie

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: ray@rodonnell.ie, shishaozhong@gmail.com
  Subject: Re: Can we use sql language to create a function in Postgres?
  In-Reply-To: <ef205ba5-232e-3e67-1efb-27c6fd1bf591@rodonnell.ie>
  References: <CA+i5JwaqmXc1KWVORo0xpSO0wb8tMfrFEojxV08gnR6Jb5FLyw@mail.gmail.com> <3716cb3b-21e9-a204-1b2c-37a4f023c72f@rodonnell.ie> <ef205ba5-232e-3e67-1efb-27c6fd1bf591@rodonnell.ie>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox