NYCPHP Meetup

NYPHP.org

[nycphp-talk] PEAR Prepare and Oracle to_date

Eric Gewirtz egewirtz at rcn.com
Fri Feb 11 22:34:30 EST 2005


Thanks Daniel,

I will attempt to be more concise in the future. Your suggestion was
helpful, at least now I know what Oracle is complaining about.
Unfortunately, the error message is not useful because my date is in
range even though Oracle is saying it is out of range.

Below is the output of my code. I did a var_dump of the data array that
I am passing to ->execute, my date looks good and the format of the
compiled sql insert does not have a syntax error.

data string is 
array(4) {
  [0]=>
  string(4) "Eric"
  [1]=>
  string(7) "Gewirtz"
  [2]=>
  int(46)
  [3]=>
  string(21) "'2010-12-31 23:59:59'"
}
EXECUTE FAILED 
INSERT INTO TESTERIC (FNAME,LNAME,AGE,BDATE) VALUES
(?,?,?,to_date(?,'yyyy-mm-dd hh24:mi:ss')) [nativecode=ORA-01841: (full)
year must be between -4713 and +9999, and not be 0
]

Any help would be appreciated - thanks

Eric


Eric Gewirtz
SolutionOne
Phone - 845-729-7800
Fax     - 845-279-5502
egewirtz at rcn.com
 

>-----Original Message-----
>From: talk-bounces at lists.nyphp.org
[mailto:talk-bounces at lists.nyphp.org] On
>Behalf Of Daniel Convissor
>Sent: Friday, February 11, 2005 6:00 PM
>To: NYPHP Talk
>Subject: Re: [nycphp-talk] PEAR Prepare and Oracle to_date
>
>Hi Eric:
>
>On Fri, Feb 11, 2005 at 05:24:51PM -0500, Eric Gewirtz wrote:
>... snip ...
>
>Wow.  That's a long example.  In the future, may I suggest simplifying
>things?  Makes it easier for us, let alone you, to figure out what's
going
>on.
>
>You're using the wrong object to get the error message.  Second, use
the
>getDebugInfo() method instead because it shows the native error message
>from the DBMS.
>
>> $result = $db->execute($compiled, $arrData);
>> if (DB::isError($result)) {
>>             echo "EXECUTE FAILED \n";
>>             die($db->getMessage());
>
>So, make that last line:
>
>              die($result->getDebugInfo());
>
>Now you should be able to figure out what's going on for yourself from
the
>error message.
>
>--Dan
>
>PS:  Take a look at http://www.expita.com/nomime.html.
>
>--
> T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
>            data intensive web and database programming
>                http://www.AnalysisAndSolutions.com/
> 4015 7th Ave #4, Brooklyn NY 11232  v: 718-854-0335 f: 718-854-0409
>_______________________________________________
>New York PHP Talk
>Supporting AMP Technology (Apache/MySQL/PHP)
>http://lists.nyphp.org/mailman/listinfo/talk
>http://www.nyphp.org




More information about the talk mailing list