plpgsql and COPY

From: "Joseph Bonnet" <Joseph(dot)Bonnet(at)Sodebo(dot)fr>
To: pgsql-general(at)postgresql(dot)org
Subject: plpgsql and COPY
Date: 2001-06-26 12:00:05
Message-ID: 9h9tg7$4sd$1@news.tht.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

Y want to use COPY command in a PLpgSQL procedure like this:

CREATE FUNCTION integration_salarie () RETURNS integer AS '
DECLARE

hemp_r record;
i integer := 0;
emp_exist integer := 0;
hnom varchar;
hpnom varchar;
hpos integer := 0;
hcoddep varchar;

BEGIN

drop table tmphoremp;
create table tmphoremp ( MATRI char(10),
NOMPRE char(30),
CCONT char(2),
MDATREC char(8),
DATCLO char(8),
TYPCONT char(3),
SOCPAIE char(2),
HORSECT char(16)
);

COPY tmphoremp FROM ''/home/public/intrasec/import/HOPEMP12.trs'' USING
DELIMITERS ''\t'';

IF NOT FOUND THEN RETURN -1;
ELSE RETURN i;
END IF;

END;

' LANGUAGE 'plpgsql';

Y have always the response : CopyObjet: don't know to copy 610

What's wrong ?

Thanks for your response.
Joseph Bonnet.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Paul Tomblin 2001-06-26 12:00:28 Re: Red Hat to support PostgreSQL
Previous Message Paul Tomblin 2001-06-26 11:47:37 Re: Red Hat to support PostgreSQL