×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Bad date external representation error

Bad date external representation error

Bad date external representation error

(OP)
While trying to debug another programmers code I run into 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=''
---------------------------------------------

The section of code which produces the eror is as follows:

$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;
------------------------------------------
Any advice or help on this error would be greatly appreciated.
Thanks in advance,
Jim

RE: Bad date external representation error

'just a guess.....sounds like the data base does not like your date format for some reason.  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).


$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;
} # I assume this is correctly matched elsewhere.
$sth = $dbh->prepare("update inventory set replicated='t' where replicated='f'");
$rv= $sth->execute( ) ¦¦ die print $dbh->errstr;


If this does not point to the problem, please indicate which line is # 114




keep the rudder amid ship and beware the odd typo

RE: Bad date external representation error

(OP)
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.

> } # I assume this is correctly matched
> elsewhere.
-It is.

Line 114 is:

my $rv1= $sth1->execute( ) ¦¦ die print $dbh->errstr,"\n",$statement;

Any thoughts?
T.I.A.!
Jim

RE: Bad date external representation error

I don't know if this matters but the line:

my $rv1= $sth1->execute( ) ¦¦ die print $dbh->errstr, "\n",$statement;

might be better written as:

my $rv1= $sth1->execute( ) or die $dbh->errstr, "\n",$statement;


I remember reading in the DBI documentation that you should use or rather than ¦¦ and you don't need the keyword  print after  die, that's you're seeing the 1 in the error message rather than your Update statement.

Mike
michael.j.lacey@ntlworld.com
Cargill's Corporate Web Site

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close