Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

ORA-01861 Error!!

Posted on 2006-07-20
5
Medium Priority
?
573 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Your data is at risk. Probably more today that at any other time in history. There are simply more people with more access to the Web with bad intentions.
Lotus Notes has been used since a very long time as an e-mail client and is very popular because of it's unmatched security. In this article we are going to learn about  RRV Bucket corruption and understand various methods to Fix "RRV Bucket Corrupt…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
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…
Suggested Courses

618 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