frustrated by plpgsql procedure

Поиск
Список
Период
Сортировка
От Dino Vliet
Тема frustrated by plpgsql procedure
Дата
Msg-id 20060327191033.38804.qmail@web51111.mail.yahoo.com
обсуждение исходный текст
Ответы Re: frustrated by plpgsql procedure  (Bricklen Anderson <banderson@presinet.com>)
Re: frustrated by plpgsql procedure  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: frustrated by plpgsql procedure  (John DeSoi <desoi@pgedit.com>)
Список pgsql-general
Hi guys,

I trying for days to get this simple plpgsql procedure
to run but I keep getting this error:

psql:pgsql_procedure.txt:15: ERROR:  syntax error at
or near  at character 17
QUERY:  copy cancel TO $1 with delimiter as ',' null
as '.'
CONTEXT:  SQL statement in PL/PgSQL function doedit
near line 12
psql:pgsql_procedure.txt:15: LINE 1: copy cancel TO $1
 with delimiter as ',' null as '.'
psql:pgsql_procedure.txt:15:

The source code of this plpgsql procedure is:

create or replace function doedit() returns void AS $$
/* Procedure to create textfile from database table.
*/

DECLARE
i integer := 340;
start date :='2004-08-06';
eind date :='2004-08-12';
location varchar(30) :='/usr/Data/plpgtrainin';

BEGIN
create table cancel as (SOME QUERY);
location := location || i || '.txt' ::varchar(30);
raise notice 'location is here %', location;
copy cancel TO location with delimiter as ',' null as
'.' ;
END
$$ Language plpgsql;

Can somebody tell me why my location variable is NOT
working as expected? I would like to use it in a loop
to create multiple text files  which names would be
different because of the way I concatenate it with the
looping variable.

Hope somebody can help me because it's a big
frustration.

Thanks in advanced.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

В списке pgsql-general по дате отправления:

Предыдущее
От: Kevin Murphy
Дата:
Сообщение: Re: How can I known the size of a database, table by table ?
Следующее
От: Bricklen Anderson
Дата:
Сообщение: Re: frustrated by plpgsql procedure