Search Postgresql Archives

Function with COPY command?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Is there any way to make this function work?

CREATE OR REPLACE FUNCTION import_text_file(char(255)) RETURNS void AS $$
DECLARE
    filename ALIAS FOR $1;
BEGIN
    COPY table FROM filename;
END;
$$ LANGUAGE plpgsql;

The version below works fine, but I need something like the above version.

CREATE OR REPLACE FUNCTION import_text_file(char(255)) RETURNS void AS $$
DECLARE
    filename ALIAS FOR $1;
BEGIN
    COPY table FROM 'C:\\somefile.txt';
END;
$$ LANGUAGE plpgsql;


--
Thanks,

Warren


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux