Home » SQL & PL/SQL » SQL & PL/SQL » Formatting a date
Formatting a date [message #365138] Fri, 07 April 2000 07:56
Dominic Dougherty
Messages: 1
Registered: April 2000
Junior Member
What is this about setting nls date format.

use this
Assumption the usr_field4 is a date field

-----------start----------
SET HEADING OFF
SET PAGESIZE 0
SET LINESIZE 970
SET COLSEP ""
SET ECHO OFF
SET FEEDBACK OFF
SET FLUSH OFF
SET TERMOUT OFF
set trimspool off

SPOOL c:\1.txt

SELECT user,to_char(sysdate,'mm/dd/yyyy'),user
FROM dual;

SPOOL OFF

---------- end --------------
Re: Formatting a date [message #365908 is a reply to message #365138] Tue, 14 March 2000 15:22 Go to previous message
Linda McDowell
Messages: 2
Registered: March 2000
Junior Member
I get invalid command for trim. Should it be rtrim?
Re: Formatting a date [message #365909 is a reply to message #365908] Tue, 14 March 2000 15:28 Go to previous message
Tom Sella
Messages: 1
Registered: March 2000
Junior Member
TRIM() works for me. Since you said you have an extra on the right RTRIM() will work fine for you.
Re: Formatting a date [message #365910 is a reply to message #365909] Tue, 14 March 2000 15:42 Go to previous message
Linda McDowell
Messages: 2
Registered: March 2000
Junior Member
Maybe it's the version of oracle we're on 7.3.2.1. I tried rtrim, it accepts the syntax but I'm still left with the 65 spaces following the date. I got it to work by altering the session set nls_date_format= 'mm/dd/yyyy', but I thought there must be an easier way.
Previous Topic: Re: SQLPlus problem
Next Topic: change column
Goto Forum:
  


Current Time: Tue Jun 22 00:45:01 CDT 2021