• 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

database equivalent for XML time

 
Ranch Hand
Posts: 1934
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to insert xml element in time format(specified as of type time example 20:00:00 in XSD) into Oracle database.

What is the appropriate equivalent for time format as above in database representation? I tried timestamp, interval etc but none of them match the accept the above format.
 
Marshal
Posts: 27214
87
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So your question is "I have this time, like 20:00:00, and how do I define and/or insert it in an Oracle database?"

Doesn't sound like an XML question to me. Let's move it to JDBC.
 
author & internet detective
Posts: 41093
848
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Kishore,
You have a few choices here:
1) Date - convert to a Java Date and store that
2) String - convert to a Java String and store that
3) XML - some databases like Oracle 10g have built in XML support
 
Kishore Dandu
Ranch Hand
Posts: 1934
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using a tool called XSU to transform from XML to database columns. It is having problems if i define the 'time' based node from XML.

It only works in case i map it to a String, it has problems if i try to map 20:00:00 to a interval or date. I can not use String because i need to do sorting on these time stamps.

Any thoughts on this anamoly?
 
Paul Clapham
Marshal
Posts: 27214
87
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Kishore Dandu:
I can not use String because i need to do sorting on these time stamps.

I don't understand this. Can you give an example of a pair of times that sort incorrectly when you use their string representations?
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You want to declare your column with the DATE type. If Oracle gives you a hard time about not specifying a date, you can attach an XSL script to your OracleXMLSave object and add one before saving.
 
You ought to ventilate your mind and let the cobwebs out of it. Use this cup to catch the tiny ads:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic