Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Oracle Date fields and perl

by abhishes (Friar)
on Mar 05, 2003 at 20:22 UTC ( [id://240690]=perlquestion: print w/replies, xml ) Need Help??

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://240690]
Approved by Elian
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (2)
As of 2024-07-21 07:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.