ORA-01861: literal does not match format string

Posted on 2003-11-10
Last Modified: 2011-08-18
Hi Gurus,

I have a table WO as:

SQL> Desc WO
actstart    date
actfinish   date
estdur     float
wonum    varchar2(10)

In a package, I declare:

   type actstart_tab_type is table of date index by binary_integer;
   actstart_tab     actstart_tab_type;

What I want to do it calculate the ACTSTART(date) by using  ACTFINISH (date)  minus ESTDUR (h)
In one of the triggres:

     IF :new.status = 'COMP' THEN
      wo_act_time_pkg.actstart_tab(wo_act_time_pkg.actstart_tab.COUNT+1) :=
      to_date((:new.actfinish-:old.estdur/24),'dd-Mon-yy HHMI');  
     END IF;  

and then in other:

UPDATE WO  SET ACTSTART= (wo_act_time_pkg.actstart_tab(i)
        where WONUM = wo_act_time_pkg.wo_tab(i);

I  got ORA-01861: literal does not match format string when the first trigger was fired. Tried with many TO_DATE format but could not solve problem. Oracle 8163

Please help.

Question by:baonguyen1
  • 2
  • 2
LVL 47

Accepted Solution

schwertner earned 150 total points
ID: 9715310
to_date((:new.actfinish-:old.estdur/24),'dd-Mon-yy HHMI') has no meaning. It is DATE!!!!

(:new.actfinish-:old.estdur/24)   - use this as date.

If you are curious about the value look at the result so:

to_char((:new.actfinish-:old.estdur/24),'dd-Mon-yy HHMI')


Author Comment

ID: 9719985
Thanks  schwertner. It was my big mistake.

It works now.

LVL 47

Expert Comment

ID: 9721395
Thanks baonguyen1!
But why you grade the answer with B?
You got the truth, I am not guilty that you were surprised!

Author Comment

ID: 9722300
I did not aware that I just grade with B. Can I have chance to reverse to A ?

Thanks a lot for your help and sorry for a B grade.



Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…

920 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

13 Experts available now in Live!

Get 1:1 Help Now