![]() Songs from the Big Chair | Tears for Fears | 1985 The Dark Side of the Moon | Pink Floyd | 1973 - -Īppetite for Destruction | Guns N' Roses | 1987 Using \qecho in conjunction with \o does place the query itself in the written file with the query's results as shown in the next listed output. This is demonstrated in the next screen snapshot. ![]() ![]() One approach to ensuring that the query itself is output with the query's results written to the file is to use the \qecho meta-command to explicitly write the query to the spooled file before running the query. The query itself, even the longer query produced by using \set ECHO_HIDDEN on, is not contained in the output. Only the results of the query run in psql are contained in the generated output.txt file. The file output.txt written via psql's \o meta-command is shown in the next listing. The following screen snapshot shows this in action in psql. PostgreSQL's command-line tool, psql, provides functionality similar to SQL*Plus's SPOOL with the \o ( \out) meta-command. Oracle's SQL*Plus's SPOOL-ed output.txt: SQL> select table_name from user_tables ![]() Both the executed query and the results of the query have been spooled to the file output.txt as shown in the next listing of that file.
0 Comments
Leave a Reply. |