db-ddlutils-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Dudziak" <tom...@gmail.com>
Subject Re: create DML for Oracle timestamp or date? (ie: with to_date)
Date Sun, 25 Mar 2007 19:06:57 GMT
On 3/22/07, ggsmnielsen@yahoo.com <ggsmnielsen@yahoo.com> wrote:

>   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"
>       <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"
>     </table>
> (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.

That is odd. DdlUtils should generate an ISO-formatted timestamp
literal for which no TO_DATE function call is necessary. Could you
post the build file or code snippet where you use DdlUtils ?


View raw message