Re: HELP! TO_CHAR FUNCTION IN SELECT - Oracle7 on Windows 95

From: Mark Styles <marks_at_sensible.teleord.co.uk>
Date: 1996/04/26
Message-ID: <4lqpk1$ama_at_sensible.teleord.co.uk>#1/1


Harpreet Chawla <chawla_at_niehs.nih.gov> wrote:
>
>SELECT TO_CHAR(col_with_date_datatype, 'mm/dd/yy hh24:mi:ss') "Date and
> Time",col_a,col_b FROM table_name WHERE ...;
>
>is producing too-wide (almost 80 column) "Date and Time" column display.
>SQL*Plus 32 is executing the SQL commands. I have tried
>
> COLUMN name FORMAT A20
>
>but has no affect on the display format. Similar examples in Oracle
>manuals show proper output.

The COLUMN command uses the full column identifier, or the column alias, obviously it is best to use the alias, so you need:

COLUMN "Date and Time" FORMAT a20

before your select statement

Alternatively, if you were feeling in a nasty mood, you could do:

COLUMN TO_CHAR(col_with_date_datatype, 'mm/dd/yy hh24:mi:ss') FORMAT a20

but I wouldn't recommend it ;-)

-- 
** Mark Styles aka Small       -- Opinions expressed here are my own --   **
** marks_at_teleord.co.uk         -- unless otherwise specified         --   **
**           This whole world's wild at heart and weird on top            **
Received on Fri Apr 26 1996 - 00:00:00 CEST

Original text of this message