1

I am attempting to run an sql query and its output was previously formatted in sqlplus but now I am trying to format it in Postgres and I do not know how to do it. Here is how it was previously formatted in sql plus but I have commented out the formatting statements

/** Contains sql script used to generate the Earth orientation data verification report**/


/*set pagesize 66 
set linesize 75

ttitle center EarthOrientation Parameters(U) 
2                                                  

column year heading "Year" format 9999
column month heading "Month" format 99
column day heading "Day" format 99
column mjd heading "MJD" format 99999
column xaxisrotation heading "x(arcsec)" format 99.9999
column yaxisrotation heading "y(arcsec)" format 99.9999
column ut1utcdelta heading "UT1-UTC(sec) format 9.99999*/

\o /h/USERS/local/Palito/results.log   

SELECT *  FROM TB_EARTHORIENTATIONPARAMETER order by earthorientationparameterid; 

\o

I have looked online but all I can find is the syntax for setting the title, column and other things but all I can find is SQLPlus syntax. please assist me with this issue if anyone has knowledge of this.

1
  • I had to do a web search to discover what sqlplus was -- it is an Oracle report generation utility to format query results. I'm not sure which report generation utility would be most useful for someone moving from Oracle to PostgreSQL. (Just adding this note to help save others time when trying to respond to the question.) Commented Aug 7, 2012 at 16:01

1 Answer 1

2

now I am trying to format it in Postgres

Postgres (actually PostgresSQL) is the server, it's not an application. You surely mean psql, which is the default terminal client program.

psql does not offer such formatting capabilities, for each column of a query. It just supports the default formatting, together with a "expanded table formatting mode" (\x) (one line per field, and a HTML output format (see docs).

Of course, you can just format each field in the SELECT itself, with the several to_char() formatting functions.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.