Re: Inserting data from one database to another using stored functions

From: Richard Huxton <dev(at)archonet(dot)com>
To: Benjie Buluran <benjie(dot)buluran(at)igentechnologies(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Inserting data from one database to another using stored functions
Date: 2011-01-07 12:40:03
Message-ID: 4D2709A3.70401@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 07/01/11 01:56, Benjie Buluran wrote:
> Hi pgSQL peeps!
>
> I’m stumped on this question for over 3 days now.

> PERFORM dblink_exec('SELECT sp_insert_detailtable('|| pActivityId ||',
> '|| pserialnumber ||')');

> I’m using the DEBUG function in pgAdmin, and I keep getting the
> “*statement returning results not allowed*” error in /PERFORM
> dblink_exec('SELECT sp_insert_detailtable('|| pActivityId ||', '||
> pserialnumber ||')');/ in this line.

A quick look at the docs for dblink_exec say "dblink_exec executes a
command (that is, any SQL statement that doesn't return rows)". A SELECT
statement returns rows. Zero rows are still rows. What happens if you
just use dblink(...)?

http://www.postgresql.org/docs/9.0/static/contrib-dblink-exec.html
http://www.postgresql.org/docs/9.0/static/contrib-dblink.html

--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-general by date

  From Date Subject
Next Message gvim 2011-01-07 15:46:31 Backup and restore sequences
Previous Message Thomas Kellerer 2011-01-07 10:28:43 Re: Query to find sum of grouped counts from 2 tables