470,581 Members | 2,438 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,581 developers. It's quick & easy.

SQL count not matching the results of perl script count

154 100+
Hi I am having a problme where the results of the sql count is not matching the results of the perl script sql count.

The script was working fine up till Wed last week and after that the results are different on sql and on perl and the date and times are the same, I even copy and pasted the sql query from the perl script into the sql window and got different results.

Here is part of the script where i am trying to get the count
$enter_date = " between to_date('11/22/06 15:24','mm/dd/yy hh24:mi:ss')
and to_date('11/22/06 15:30','mm/dd/yy hh24:mi:ss')";

$repoSQL = qq{

select count(*) from site s where (s.lastupdateddate) $enter_date

$sth1 = $repoCon->prepare($repoSQL);

$kntr = $sth1->fetchrow_array() ;

$repoSQL = qq{

select count(*) from site s where (s.createddate) $enter_date

$sth2 = $repoCon->prepare($repoSQL);

$kntr2 = $sth2->fetchrow_array() ;

print "Updated Count: $kntr \n
Created Count: $kntr2 ";
$message = "Please find the attached Site Error Report. The Site Error Report reports errors occurring in the last 15 days. \n\n
Number of records updated within the last 24 hours is: $kntr \n\n\n
Number of records created within the last 24 hours is: $kntr2";

Hope you guys could help me out, I would really appreciate it.

Nov 27 '06 #1
2 4532
1,089 Expert 1GB
Add error checking to your execute:
Expand|Select|Wrap|Line Numbers
  1. $sth1 = $repoCon->prepare($repoSQL);
  2. $sth1->execute() or die $repoCon->errstr;
Also, your function TO_DATE does not appear to exist in the latest version of MySQL.

Maybe you need the STR_TO_DATE function instead?
Nov 28 '06 #2
154 100+
soory i forogt to mention this is linking to an oracle database and not mysql

Will put that error checking and see what happens thanks
Nov 28 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

9 posts views Thread by Xah Lee | last post: by
reply views Thread by Eric A. Hall | last post: by
4 posts views Thread by vacataire testeur de site web | last post: by
1 post views Thread by Peter v.d. Berger | last post: by
1 post views Thread by anderz1985 | last post: by
1 post views Thread by livre | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.