472,973 Members | 2,266 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,973 software developers and data experts.

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);
$sth1->execute();

$kntr = $sth1->fetchrow_array() ;

$repoSQL = qq{

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

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

$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";
--------------------------end--------------------------------

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

Thanks
Nov 27 '06 #1
2 4794
miller
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;
  3.  
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?
http://www.mysql.org/doc/refman/5.1/en/date-and-time-functions.html
Nov 28 '06 #2
jonathan184
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

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

Similar topics

9
by: Xah Lee | last post by:
# -*- coding: utf-8 -*- # Python # Matching string patterns # # Sometimes you want to know if a string is of # particular pattern. Let's say in your website # you have converted all images...
4
by: Xah Lee | last post by:
20050207 text pattern matching # -*- coding: utf-8 -*- # Python # suppose you want to replace all strings of the form # <img src="some.gif" width="30" height="20"> # to # <img...
0
by: Eric A. Hall | last post by:
I'm trying to scratch up a whois-like client in perl, and am having a strange problem with matching input characters. Specifically, matching against things like "@" works fine over the network, but...
4
by: vacataire testeur de site web | last post by:
Bonjour je cherche à afficher de count de tables identiques dans la forme exemple num_cli | nombre de poste | nombre de voiture 1 1 3 2 2 ...
0
by: Peter Rilling | last post by:
I am working on trying to compare "titles" from two different lists and trying to determine the most likely match. When a similar entry appears in both, the result works well, but what I need to...
1
by: Peter v.d. Berger | last post by:
Hello, I'm working on a script that can place results of soccergames from different seasons in a row, to see the history of the game. I've gattered a lot of scores from different websites on a...
1
by: anderz1985 | last post by:
I am stuck on a question which is asking me to write a perl script that passes a data file matching perl script. Wil be thankful for any help james
2
by: Harch84 | last post by:
Hi guys really hoping someone can advise me with this. I have a Perl script that connect to a PostgreSQL database and retrieves fields and rows from a database of bus timetables and bus stop...
7
Kelicula
by: Kelicula | last post by:
Is it possible to include the results from a cgi script in another cgi script? Here is what I am trying to do. cgi script 1, creates a web page dynamically depending on certain attributes of an...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.