Solved

ORA-01861: literal does not match format string

Posted on 2003-11-10
4
79,264 Views
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:

BEGIN
     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;  
END;
/


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.

Thanks
0
Comment
Question by:baonguyen1
  • 2
  • 2
4 Comments
 
LVL 47

Accepted Solution

by:
schwertner earned 150 total points
Comment Utility
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')

0
 
LVL 8

Author Comment

by:baonguyen1
Comment Utility
Thanks  schwertner. It was my big mistake.

It works now.

Cheers,
0
 
LVL 47

Expert Comment

by:schwertner
Comment Utility
Thanks baonguyen1!
But why you grade the answer with B?
You got the truth, I am not guilty that you were surprised!
0
 
LVL 8

Author Comment

by:baonguyen1
Comment Utility
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.

Cheers,

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

This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

762 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

6 Experts available now in Live!

Get 1:1 Help Now