abhishes has asked for the wisdom of the Perl Monks concerning the following question:

Hello All,

I have strings in the format yyyymmddhhmmss

I have to insert them into an Oracle Table into a column which is of type DATE.

I am using Win32::ODBC to do this.

Can someone give me a code snippet which will insert this string into a Oracle Table Column of type date? In such a way that oracle gets all the fields correctly.

thanks,
Abhishek.

Replies are listed 'Best First'.
Re: Oracle Date fields and perl
by arturo (Vicar) on Mar 05, 2003 at 20:36 UTC

    I would use Oracle's built-in to_date(datestring, formatstring) function, e.g.:

    UPDATE table SET date_field = to_date(?, 'YYYYMMDDHH24MISS') WHERE id = ?
    , assuming of course that by "hh" you mean 24-hour.

    If not P, what? Q maybe?
    "Sidney Morgenbesser"

      that works! thank you.