Wednesday, August 6, 2008

[NOVICE] COPY TO Question?

This email is subject to a disclaimer which may be found on our website by clicking on this link: disclaimer. If you would prefer, the disclaimer can be emailed to you by clicking here.

 

 

Hi

 

I am currently running PostgreSQL 8.1.3 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.2.3 20030502 (Red Hat Linux 3.2.3-47). What I need to do is COPY FROM a file into a temp table (This I know how to do), then select and manipulate the data and write it back out to groups of files. I can insert the manipulated data into another table and then use COPY TO a file but what I would like to do is open a file with a name and write pipe delimited lines to it and close it and reopen the next file, write and so on ….. pretty similar to Oracle’s utl_file.fopen, utl_file.fclose, utl_file.put_line etc. Is this available in postgres?

 

Secondly, is it possible to FTP the same files to a different server? Would I need to write some form of shell script and execute it? If so how would I go about doing this from the DB?

 

Your help is appreciated.

 

Regards

Marc

No comments: