in reply to Code flow not going to while loop

Hello dipit,

Welcome to the Monastery. It is really difficult for us to replicate your problem without having input data (sample of table).

Having said that, I have found MySQL select statements in the past failing because of not using back ticks (``). So try something like this:

my $sql = "select distinct `FID_CUST` from `session` where `DAT_END` between `$key` and `$hash{$key}`";

Give it a try and let us know if it worked.

Update: I have found really useful the phpMyAdmin it helps me to check my requests before applying them.

Update2: In case the SELECT statement is correct run something like this as fellow monk talexb proposed:

eval { ### Catch _any_ kind of failures from the code within ### Enable auto-error checking on the database handle $dbh->{RaiseError} = 1; ### Prepare a SQL statement for execution my $sth = $dbh->prepare( "select distinct `FID_CUST` from `session +` where `DAT_END` between `$key` and `$hash{$key}`" ); while (1) { ### Execute the statement in the database $sth->execute(); ### Retrieve the returned rows of data while ( my @row = $sth->fetchrow_array() ) { print "Row: @row\n"; } } }; warn "Monitoring aborted by error: $@\n" if $@;

Looking forward to your update, BR.

Seeking for Perl wisdom...on the process of learning...not there...yet!