Thread: pl/pgsql examples

pl/pgsql examples

From
Suresh Raja
Date:
Hi :

i'm looking for pgsql functions to insert rows from a select query.  I'm new pgsql.  So please bear with me.  Can you share some sample code if you have. Or if you interested in writing the code, i can out source.

Cheers!
-SR

Re: pl/pgsql examples

From
Adrian Klaver
Date:
On 11/21/2014 07:48 AM, Suresh Raja wrote:
> Hi :
>
> i'm looking for pgsql functions to insert rows from a select query.  I'm
> new pgsql.  So please bear with me.  Can you share some sample code if
> you have. Or if you interested in writing the code, i can out source.

Could you provide some pseudo code outlining what is want to accomplish?

Say something like:

CREATE FUNCTION some_fnc()
SELECT fld_1, fld_2, fld_3 FROM some_table WHERE id = <some_parameter>
INSERT INTO another_table(fld1, fld2, fld3) VALUES(fld_1, fld_2, fld_3)

Obviously this a simple contrived example. The more detail you can 
provide, the better.

>
> Cheers!
> -SR


-- 
Adrian Klaver
adrian.klaver@aklaver.com



Re: pl/pgsql examples

From
Oliver Christina
Date:
Not Sure if you need pl/pgsql for that.
A insert SELECT query will do if I am understanding what you want to do...

Best,
Oliver

Sent from Oliver's iPhone

> On 21 Nov 2014, at 03:48 p.m., Suresh Raja <suresh.rajaabc@gmail.com> wrote:
>
> Hi :
>
> i'm looking for pgsql functions to insert rows from a select query.  I'm new pgsql.  So please bear with me.  Can you
sharesome sample code if you have. Or if you interested in writing the code, i can out source. 
>
> Cheers!
> -SR