Thread: Select results output to file?
I want to output to a file, but haven't found anything but the SQL copy statement. I want to output the results of a select statement, though. Ideally I'd be doing this from inside a pl/pgsql function. I've looked through both books and searched the archives. Seems like this should be a common thing to do; what did I miss? Thanks! Dennis __________________________________________________ Do you Yahoo!? Yahoo! Web Hosting - establish your business online http://webhosting.yahoo.com
Dennis King wrote: > I want to output to a file, but haven't found anything but the SQL > copy statement. I want to output the results of a select statement, > though. Ideally I'd be doing this from inside a pl/pgsql function. You can't do that from a plpgsql function short of writing your own C function and calling it from there. You probably can write to a output file from plperlu or pltclu; see: http://www.us.postgresql.org/users-lounge/docs/7.3/postgres/plperl-trusted.html http://www.us.postgresql.org/users-lounge/docs/7.3/postgres/pltcl.html You can also use psql either in batch mode or interactively; see: http://www.us.postgresql.org/users-lounge/docs/7.3/postgres/app-psql.html Joe