Solved

ORA-01821: date format not recognized -- SELECT TO_CHAR(SYSDATE,'HH:MI:SS.FF') FROM sys.dual;

Posted on 2004-08-27
4
19,789 Views
Last Modified: 2007-11-27
Hi,
I have the following:
    select to_char(sysdate,'hhmiss') into v_time from dual;
    g_logFileName := 'bcarldebug'||v_time ||'.dbg';

 Trying to add hundereds to my file names to not overwrite ones that are written already.

I tried the following: (different times...)
      SQL> ALTER SESSION SET NLS_TIMESTAMP_FORMAT = 'YYYY-MM-DD HH:MI:SS.FF';
      Session altered.

      start_time TIMESTAMP(4);
      PLS-00201: identifier 'TIMESTAMP' must be declared
      
      SELECT TO_CHAR(SYSDATE,'HH:MI:SS.FF') FROM sys.dual;
      ORA-01821: date format not recognized
   
  1  SELECT TO_TIMESTAMP('11-nov-2000 01:00:00.336', 'dd-mon-yyyy hh:mi:ss.ff')
  2* FROM dual
SQL> /
SELECT TO_TIMESTAMP('11-nov-2000 01:00:00.336', 'dd-mon-yyyy hh:mi:ss.ff')
            *
ERROR at line 1:
ORA-00904: invalid column name

      Gave up....



0
Comment
Question by:bcarlis
  • 2
4 Comments
 
LVL 9

Expert Comment

by:konektor
ID: 11912636
u cannot use sysdate to obtain time in ff format
this works :
SELECT TO_CHAR(SYSTIMESTAMP, 'SS.FF3') from dual;

SELECT TO_TIMESTAMP ('1999-12-01 11:00:00.1234', 'YYYY-MM-DD HH:MI:SS.FF4') FROM DUAL
0
 
LVL 23

Accepted Solution

by:
paquicuba earned 50 total points
ID: 11913291
What Oracle version are you using?
Keep in mind that timestamp, timestamp with time zone, timestamp with local time zone, interval day to second and interval year to month datatypes were introduced in Oracle9i.
0
 
LVL 2

Author Comment

by:bcarlis
ID: 11918130
No way to do it with 8.1.7 ???

Bill :>)

konektor:
I GET ERROR....

SQL> SELECT TO_CHAR(SYSTIMESTAMP, 'SS.FF3') from dual;
SELECT TO_CHAR(SYSTIMESTAMP, 'SS.FF3') from dual
                            *
ERROR at line 1:
ORA-00904: invalid column name

paquicuba:

Oracle8i Enterprise Edition Release 8.1.7.4.0 - 64bit Production
PL/SQL Release 8.1.7.4.0 - Production
CORE    8.1.7.0.0       Production
TNS for HPUX: Version 8.1.7.4.0 - Production
NLSRTL Version 3.4.1.0.0 - Production






0
 
LVL 2

Author Comment

by:bcarlis
ID: 11918139

What if I have a table with a TIMESTAMP datatype?
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Oracle SQL 6 73
Shredding xml into an oracle 11g Database 2 59
ODBC in excel 2016 in Windows 10 via VBA 16 138
Oracle dataguard 5 45
Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question