Hi,

I'm using Class::DBI and I'm trying to update a field in my Oracle DB that is of "Date" type. My routines has been working well for numbers and strings but I'm having some difficult with the date datatype.

In the past, when I was just using DBI I would use some SQL like:

update tablename set foo = 'bar', date = to_date( '03/03/2004', 'MM/DD/YYYY' ) where id = '1'

With Class::DBI I've been passing a hash into it where the hash has column/value pairs.

# Do the DB insert $dn_entry->set( %dn_out ); $dn_entry->update; $dn_entry->dbi_commit();

I tried filling my hash with the same to_date function call string like above and I got this error....

DB error: Can't update 50025: DBD::Oracle:: st execute failed: ORA-01858: a non-numeric character was found where +a numeric was expected (DBD ERROR: OCIStmtExecute) [for statement ``UPDATE Domai +nNames SET domainname = ?, expire_date = ?, dn_id = ? WHERE dn_id=? + '']) at ../Modules/site_perl/5.005/Ima/DBI.pm line 720.

Any ideas how to use Class::DBI and oracle together to set date field values?

Cheers

-------------------------------------
Nothing is too wonderful to be true
-- Michael Faraday


In reply to Class::DBI / Oracle date field Q by freddo411

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.