CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Bad date external representation Error

 



yim11
Novice

Jun 27, 2000, 5:26 AM

Post #1 of 3 (1080 views)
Bad date external representation Error Can't Post

I am receiving the following error:
DBD::Pg::st execute failed: ERROR: Bad date external representation ''
1 at /home/sbergm1/replicate_inventory.pl line 114.
ERROR: Bad date external representation ''

update inventory set replicated='t' where idnumber='' and catno='' and datereceived=''
----------------------------------
from the following section of code:

$update=join(',',@updates); $statement="update inventory set $update where idnumber='$id' and catno='$catno' and datereceived='$datereceived'";
my $sth1 = $dbh1->prepare("$statement");
my $rv1= $sth1->execute( ) | | die print $dbh->errstr,"\n",$statement;
} $sth = $dbh->prepare("update inventory set replicated='t' where
replicated='f'");
$rv= $sth->execute( ) | | die print $dbh->errstr;
---------------------------------
Line 114 is the line that reads:
my $rv1= $sth1->execute( ) or die $dbh->errstr,"\n",$statement;

Any thoughts or help on this is GREATLY appreciated.
T.I.A.!
Jim


dws
Deleted

Jun 26, 2000, 10:49 PM

Post #2 of 3 (1080 views)
Re: Bad date external representation Error [In reply to] Can't Post

It appears that by expanding the date into the query yourself, you're not getting it into a form that the underlying database will accept. Try binding the date as a parameter. In that way, perhaps [note: this means I'm speculating] the underlying binding mechanism will do the correct converion for you.

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>

$statement="update inventory set $update
where idnumber='$id'
and catno='$catno'
and datereceived=?";
my $sth1 = $dbh1->prepare($statement);
my $rv1= $sth1->execute($datereceived)
or die print $dbh->errstr,"\n",$statement;</pre><HR></BLOCKQUOTE>

If that doesn't work, you'll need to figure out what date format the underlying database wants, and force the $daterecieved into that format.



yim11
Novice

Jun 29, 2000, 7:12 AM

Post #3 of 3 (1080 views)
Re: Bad date external representation Error [In reply to] Can't Post

DWS,
THANK YOU VERY MUCH! I do believe you were correct and your replacement code worked great~!

I _really_ appreciate it!
-yim11

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives