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,455 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.

Join & Write a Comment

Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
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 how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now