Re: Inserting times into Oracle with PEAR DB
| From: | Justin Patrin | Date: | Tue, 10 Feb 2004 22:45:00 +0000 |
| Subject: | Re: Inserting times into Oracle with PEAR DB | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-10616@lists.php.net to get a copy of this message | ||
Shawn Coomey wrote:
[snip]
I am trying to figure out how to insert a time into an Oracle 9i database using PEAR DB. Here's an example of what I am trying to do: Problem is that Oracle keeps returning a "not a valid month" error upon execution. Is there a way to call the Oracle TO_DATE() function from a pear prepare/execute statement? [/snip]Well, I have never used prepare and such, but I have found a way to have Oracle read dates with times without TO_DATE or another similar function. $sql = 'alter session set NLS_DATE_FORMAT=\'DD-MON-YY HH24:MI:SS\''; $db->query($sql); If you run that, you can pass date/times as '01-JAN-02 13:17:45'. If you want another format, just look up the Oracle codes for the format strign and change it. :-) -- paperCrane <Justin Patrin>