?
Solved

ORA-01861 Error!!

Posted on 2006-07-20
5
Medium Priority
?
571 Views
Last Modified: 2008-01-09
Hi,


The following exception is caught while running my aplication.

-------------------------------------------------------
ORA-01861: literal does not match format string  
-------------------------------------------------------

The exception is caught while trying to insert data into a temporary table

The temporary table is created using the following query.
-------------------------------------------------------------------
CREATE GLOBAL TEMPORARY TABLE TempAvgDistRecords  
(
PROJEKTID NUMBER,
FIRMAID VARCHAR(20),
GEBIETID VARCHAR(20),
DATUM DATE,
DATUMVON DATE,
DATUMBIS DATE
)
-------------------------------------------------------------------



Query which fetches data is as follows
------------------------------------------------------------------------------------------------------------------
SELECT DISTINCT PJDT.PROJEKTID, PJDT.FIRMAID, PJDT.DATUM, PJVS.GEBIETID, PJVS.DATUMVON,
PJVS.DATUMBIS FROM PJDT, PJVS,GB, GBSU WHERE PJDT.PROJEKTID = PJVS.PROJEKTID
AND PJDT.FIRMAID = PJVS.FIRMAID  AND GB.GEBIETID = PJVS.GEBIETID AND
GB.GEBIETID = GBSU.GEBIETID AND (GBSU.SUBJEKTIDPE = 'pe01293')
AND (PJDT.DATUM BETWEEN '01-Jul-2006' and '19-Jul-2006')}
-------------------------------------------------------------------------------------------------------------------










The output of the above query is as follows:

------------------------------------------------------------------------------------------------
PROJEKTID FIRMAID              DATUM     GEBIETID             DATUMVON
---------- -------------------- --------- -------------------- ---------
DATUMBIS
---------
      7714 4                    01-JUL-06 011-000-000-201-0009 01-JAN-00
31-DEC-99

      7714 4                    08-JUL-06 011-000-000-201-0009 01-JAN-00
31-DEC-99

      7714 4                    15-JUL-06 011-000-000-201-0009 01-JAN-00
31-DEC-99


 PROJEKTID FIRMAID              DATUM     GEBIETID             DATUMVON
---------- -------------------- --------- -------------------- ---------
DATUMBIS
---------
      7742 4                    11-JUL-06 011-000-000-201-0009 01-JAN-00
31-DEC-99
---------------------------------------------------------------------------------

The “ORA-01861: literal does not match format string”  exception  is caught while trying to insert the above output data into the Temporary Table which have been created in the beginning.

Can anyone resolve this issue???


0
Comment
Question by:akshay_sumeru
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 17152018
AND (PJDT.DATUM BETWEEN TO_DATE('01-Jul-2006' , 'DD-MON-YYYY') and to_date('19-Jul-2006', 'DD-MON-YYYY') )
0
 

Author Comment

by:akshay_sumeru
ID: 17152232
!!!!
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 2000 total points
ID: 17152397
I see what is probably wrong.

you created the table with these fields:

CREATE GLOBAL TEMPORARY TABLE TempAvgDistRecords  
(
PROJEKTID NUMBER,
FIRMAID VARCHAR(20),
GEBIETID VARCHAR(20),
DATUM DATE,
DATUMVON DATE,
DATUMBIS DATE
)

but your query takes them in another order, ie DATUM before GEBIETID

SELECT DISTINCT PJDT.PROJEKTID, PJDT.FIRMAID, PJDT.DATUM, PJVS.GEBIETID, PJVS.DATUMVON,
PJVS.DATUMBIS FROM PJDT, PJVS,GB, GBSU WHERE PJDT.PROJEKTID = PJVS.PROJEKTID
AND PJDT.FIRMAID = PJVS.FIRMAID  AND GB.GEBIETID = PJVS.GEBIETID AND
GB.GEBIETID = GBSU.GEBIETID AND (GBSU.SUBJEKTIDPE = 'pe01293')
AND (PJDT.DATUM BETWEEN '01-Jul-2006' and '19-Jul-2006')}

so, change the SELECT field order for your insert:

SELECT DISTINCT PJDT.PROJEKTID, PJDT.FIRMAID, PJVS.GEBIETID, PJDT.DATUM, PJVS.DATUMVON,
PJVS.DATUMBIS FROM PJDT, PJVS,GB, GBSU WHERE PJDT.PROJEKTID = PJVS.PROJEKTID
AND PJDT.FIRMAID = PJVS.FIRMAID  AND GB.GEBIETID = PJVS.GEBIETID AND
GB.GEBIETID = GBSU.GEBIETID AND (GBSU.SUBJEKTIDPE = 'pe01293')
AND (PJDT.DATUM BETWEEN '01-Jul-2006' and '19-Jul-2006')}


0

Featured Post

Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

Question has a verified solution.

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

Recently I was talking with Tim Sharp, one of my colleagues from our Technical Account Manager team about MongoDB’s scalability. While doing some quick training with some of the Percona team, Tim brought something to my attention...
In this article, we’ll look at how to deploy ProxySQL.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

777 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