| From: | "hongliu zou" <zouhongliu(at)gmail(dot)com> |
|---|---|
| To: | pgsql-sql(at)postgresql(dot)org |
| Subject: | Syntax Error in COPY when “create function” |
| Date: | 2007-02-27 03:04:11 |
| Message-ID: | 35201a90702261904o44c18d99oa9fdbeb0dca4c9c0@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
Am I forgetting some limitation?
I get " ERROR: syntax error at or near "$1"
SQL state: 42601 "with this
CREATE FUNCTION Import1() RETURNS text AS $$
DECLARE
path Char(100);
BEGIN
path = 'C:/zhl/hjs/anc_area.att';
COPY anc_areaAtt FROM path CVS;
RETURN path;
END;
$$ LANGUAGE plpgsql;
SELECT Import1() ;
But COPY can work well when I just put the string in the command:
CREATE FUNCTION Import2() RETURNS text AS $$
DECLARE
path Char(100);
BEGIN
COPY anc_areaAtt FROM 'C:/zhl/hjs/anc_area.att' CSV;
return path;
END;
$$ LANGUAGE plpgsql;
SELECT Import2() ;
Does this mean the "filename" in COPY command can not be a variable?
By the way, my OS is windowXP.
Thanks and Regards,
Hongliu
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Ezequias Rodrigues da Rocha | 2007-02-27 11:51:27 | Position of a field |
| Previous Message | Rommel the iCeMAn | 2007-02-26 22:13:54 | Re: Change Default Database |