plpgsql and COPY - Mailing list pgsql-general

From Joseph Bonnet
Subject plpgsql and COPY
Date
Msg-id 9h9tg7$4sd$1@news.tht.net
Whole thread Raw
Responses Re: plpgsql and COPY
List 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.



pgsql-general by date:

Previous
From: Alexander Solianic
Date:
Subject: Re: JDBC and SQL
Next
From: Tom Lane
Date:
Subject: Re: OID, 4billion+ Rows.