Re: How to get text for a plpgsql variable from a file.

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Erwin Brandstetter <brsaweda(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to get text for a plpgsql variable from a file.
Date: 2009-12-16 21:47:38
Message-ID: 162867790912161347r47172835yff74a08cfa029e8@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

hello

look on orafce from pgfoundry. There modul utl_file

http://www.postgres.cz/index.php/Oracle_functionality_%28en%29#UTL_FILE

Regards
Pavel Stehule

2009/12/16 Erwin Brandstetter <brsaweda(at)gmail(dot)com>:
> Hello,
>
>        I need a long text form from a file in my plpgsql variable.
> Can anyone think of a more straightforward way to read the file than
> the following:
>
>
> CREATE FUNCTION test() RETURNS void AS
> $BODY$
> DECLARE
>        mytxt text;
> BEGIN
>
> CREATE TEMP TABLE x (x text);
> COPY x from '/path/to/myfile.txt';
> mytxt := (SELECT x from x);
>
> ...
>
> END;
> $BODY$
>  LANGUAGE 'plpgsql' VOLATILE;
>
>
>
> Regards
> Erwin
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Greg Smith 2009-12-16 21:53:58 Re: Justifying a PG over MySQL approach to a project
Previous Message Thomas Kellerer 2009-12-16 21:47:36 Re: Justifying a PG over MySQL approach to a project