Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bad date external representation error

Status
Not open for further replies.

yim11

MIS
Jun 26, 2000
35
US
While trying to debug another programmers code I run into the following error:<br><br>DBD::pg::st execute failed: ERROR:&nbsp;&nbsp;Bad date external representation ''<br>1 at /home/sbergm1/replicate_inventory.pl line 114.<br>ERROR:&nbsp;&nbsp;Bad date external representation ''<br><br>update inventory set replicated='t' where idnumber='' and catno='' and datereceived=''<br>---------------------------------------------<br><br>The section of code which produces the eror is as follows:<br><br>$update=join(',',@updates); $statement=&quot;update inventory set $update where idnumber='$id' and catno='$catno' and datereceived='$datereceived'&quot;; my $sth1 =<br>$dbh1-&gt;prepare(&quot;$statement&quot;); my $rv1= $sth1-&gt;execute( ) ¦¦ die print $dbh-&gt;errstr,&quot;\n&quot;,$statement; } $sth = $dbh-&gt;prepare(&quot;update inventory set replicated='t' where<br>replicated='f'&quot;); $rv= $sth-&gt;execute( ) ¦¦ die print $dbh-&gt;errstr; <br>------------------------------------------<br>Any advice or help on this error would be greatly appreciated. <br>Thanks in advance,<br>Jim
 
'just a guess.....sounds like the data base does not like your date format for some reason.&nbsp;&nbsp;Might try printing your $statement prior to prepare and execute to make sure your date var is a legal format (one the data base recognizes as a date).<br><br><FONT FACE=monospace><br>$update=join(',',@updates); <br>$statement=&quot;update inventory set $update where idnumber='$id' and catno='$catno' and datereceived='$datereceived'&quot;; <br> <br>my $sth1 = $dbh1-&gt;prepare(&quot;$statement&quot;); <br>my $rv1= $sth1-&gt;execute( ) ¦¦ die print $dbh-&gt;errstr,&quot;\n&quot;,$statement;<br>} <font color=red># I assume this is correctly matched elsewhere.</font><br>$sth = $dbh-&gt;prepare(&quot;update inventory set replicated='t' where replicated='f'&quot;);<br>$rv= $sth-&gt;execute( ) ¦¦ die print $dbh-&gt;errstr; <br></font><br><br>If this does not point to the problem, please indicate which line is # 114 <p> <br><a href=mailto: > </a><br><a href= > </a><br> keep the rudder amid ship and beware the odd typo
 
Thank you very much for your reply. I do believe that the database does recognize the date format but I am double checking to be sure. <br><br>&gt; } # I assume this is correctly matched<br>&gt; elsewhere.<br>-It is.<br><br>Line 114 is:<br><br>my $rv1= $sth1-&gt;execute( ) ¦¦ die print $dbh-&gt;errstr,&quot;\n&quot;,$statement;<br><br>Any thoughts?<br>T.I.A.!<br>Jim
 
I don't know if this matters but the line:<br><FONT FACE=monospace><b><br>my $rv1= $sth1-&gt;execute( ) ¦¦ die print $dbh-&gt;errstr, &quot;\n&quot;,$statement;<br></font></b><br>might be better written as:<br><FONT FACE=monospace><b><br>my $rv1= $sth1-&gt;execute( ) <font color=red>or</font> die $dbh-&gt;errstr, &quot;\n&quot;,$statement;<br></font></b><br><br>I remember reading in the DBI documentation that you should use <FONT FACE=monospace><b>or</font></b> rather than <FONT FACE=monospace><b>¦¦</font></b> and you don't need the keyword&nbsp;&nbsp;<FONT FACE=monospace><b>print</font></b> after&nbsp;&nbsp;<FONT FACE=monospace><b>die</font></b>, that's you're seeing the <FONT FACE=monospace><b><font color=red>1</font></font></b> in the error message rather than your <FONT FACE=monospace><b>Update</font></b> statement.<br> <p>Mike<br><a href=mailto:michael.j.lacey@ntlworld.com>michael.j.lacey@ntlworld.com</a><br><a href= Cargill's Corporate Web Site</a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top