What I'd like to do is use dblink to extract a few rows from a remote
database and manipulate these within a function in pl/pgsql.  Something
like this:

CREATE OR REPLACE FUNCTION find() RETURNS INTEGER AS '
  DECLARE
    count INTEGER:
    myrec RECORD;
  BEGIN
  FOR myrec IN SELECT * FROM DBLINK(''select x,y from mytab'') as
     temp(x integer, y real) LOOP
     count := count + 1;
  END LOOP;
  RETURN count;
END; ' LANGUAGE 'plpgsql';


But this syntax does not work, and I cannot find a form which does work.
Does anyone know how to do this?

Thanks in advance.

-- 
Clive Page


---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Reply via email to