...Sorry, slight red herring there, my mistake. As I was trimming down my build file to a postable size, I discovered that in reality my ddlToDatabase was not working correctly (and I have default behaviour that uses hard-coded SQL as default values for unsupported databases -- eg, teradata -- but was getting used for my Oracle output here.) Thanks for the info on to_date -- I'm thrilled to know that I don't actually need it.
My *real* problem is that my Ant task (ddlToDatabase) is not working; I get the following error, "No database model specified":
$ ant dist....
C:\mywk\sample-db\test-build.xml:154: The following error occurred while executing this line:
C:\mywk\sample-db\test-build.xml:123: No database model specified
My task looks something like:
My data looks like,
And my schema,
I saw a posting in the archive with a similar problem... but didn't see a solution (other than to use the Java API). I'm generating DDL & DML from XML, without actually connecting to databases. (I'm coming back to DDL-Utils after about a year -- and I did update my libs to the latest version -- and kind of remember this error, but can't recall the resolution.)
Any help would be much appreciated --
----- Original Message ----
From: Thomas Dudziak
Sent: Sunday, March 25, 2007 12:06:57 PM
Subject: Re: create DML for Oracle timestamp or date? (ie: with to_date)
> 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),
> My schema looks like (summarized),
> (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', 'MM/DD/YYYY'));
> 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 ?
We won't tell. Get more on shows you hate to love
(and love to hate): Yahoo! TV's Guilty Pleasures list.