This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

database equivalent for XML time

 
Kishore Dandu
Ranch Hand
Posts: 1934
  • Mark post as helpful
  • send pies
  • 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.
 
Paul Clapham
Sheriff
Pie
Posts: 20945
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • 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.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34178
340
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • 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
  • 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
Sheriff
Pie
Posts: 20945
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • 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?
 
Tracy Nelson
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic