Re: stored procedure multiple call call question

From: Chris McDonald <chrisjonmcdonald(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: stored procedure multiple call call question
Date: 2012-10-03 08:19:16
Message-ID: c0847570-94ae-49da-b4a8-12d992fb7a28@googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks very much for that David - really appreciate your response - it works like a dream

c

On Tuesday, 2 October 2012 19:42:59 UTC+1, Chris McDonald wrote:
> Hi,
>
>
>
>
>
> If I had a single table targ to insert into I would do an
>
>
>
> INSERT INTO targ SELECT thiscol, thatcol, theothercol FROM FOO.
>
>
>
> The problem is that I have tables targ1, targ2, targn to insert things into and a nice stored procedure myproc which does the insertion into all 3 tables - problem is that I dont see how I can effectively do
>
>
>
> INSERT INTO myproc SELECT thiscol, thatcol, theothercol FROM FOO.
>
>
>
> The only way I can work out how to do this is with another stored procedure which allows me to do:
>
>
>
> FOR rec IN SELECT thiscol, thatcol, theothercol
>
> FROM FOO
>
> LOOP
>
> PERFORM myproc(rec.thiscol, rec.thatcol, rec.theothercol);
>
> END LOOP;
>
>
>
> But is there a way to do this just in SQL only without resorting to plpgsql or a language like C/Java?
>
>
>
> thanks
>
>
>
> c

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Mr Dash Four 2012-10-03 10:29:30 Re: strange permission error
Previous Message Marco Craveiro 2012-10-03 06:37:05 Re: Postgres error when adding new page