db-ddlutils-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggsmniel...@yahoo.com
Subject create DML for Oracle timestamp or date? (ie: with to_date)
Date Fri, 23 Mar 2007 05:50:51 GMT


  I hope that I am missing something obvious -- if someone could point me in the right direction,
I would be very appreciative.

  I have XML data that I am trying to convert into SQL DML for Oracle (my XML to DDL works
fine).  My XML data includes Timestamps (and/or Dates), and I believe that in order to insert
this into Oracle, I am going to have to call the Oracle functions "to_timestamp" (or "to_date").
 (If I am mistaken, please let me know.)

My data looks like (summarized),
  <pubtitle id="1" pubtitle="Some Title" price="32.12" pubdate="1998-01-02 00:00:00.0"

My schema looks like (summarized),
    <table name="pubtitle">
      <column name="id" primaryKey="true" required="true" type="VARCHAR" size="10" autoIncrement="false"/>
      <column name="pubtitle" primaryKey="false" required="true" type="VARCHAR" size="80"
      <column name="price" primaryKey="false" required="false" type="DOUBLE" size="53"
      <column name="pubdate" primaryKey="false" required="true" type="TIMESTAMP" size="23,3"

(Note the timestamps.)

And unfortunately, my SQL results in:
  insert into pubtitle values( '1',  'Guide to Backpacking',  '32.12',  '1/2/1998' );

But I think it needs to be something like this (either using to_date, or to_timestamp):
  insert into pubtitle values( '1',  'Guide to Backpacking',  '32.12',  TO_DATE('1/2/1998',

  Are there Ant tasks or properties (or even Java API) that can be used to create SQL suitable
for insertion into Oracle, including dates / timestamps?  Note that I just want the SQL, I
can't use Java to read/populate the database directly.

Thanks in advance,

No need to miss a message. Get email on-the-go 
with Yahoo! Mail for Mobile. Get started.

View raw message