• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Unable to Convert in Timestamp

 
Ranch Hand
Posts: 1249
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear All,

I am trying to convert the given String in timestamp format using PL/SQL Language.

Here is the sql query i wrote to convert string in timestamp. But I am getting error "Ora-01810: format code appears twice" while executing the query. Please help me out and let me know what I am doing wrong while executing the query:

select to_timestamp('01/03/2007 12:01:22', 'MM/DD/YYYY HH24:MM:SS') from dual
and this one too

select to_timestamp('01/03/2007 12:01:22', 'MM/DD/YYYY HH12:MM:SS') from dual

At the same time I am able to execute the follwoing query:

select to_timestamp('2003/DEC/13 20:13:18', 'YYYY/MONTH/DD HH24:MI:SS') from dual

DO let me know where I am going wrong.
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Looks like you are defining the months twice in your format. Check the docs, minutes are MI.
 
Shaan Shar
Ranch Hand
Posts: 1249
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Paul Sturrock:
Looks like you are defining the months twice in your format. Check the docs, minutes are MI.



Oops Sorry.. i did it again....

Thanks Paul Sturrock..
 
See where your hand is? Not there. It's next to this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic