- $cursor_dbh->do(
- "DECLARE cron_bill_cursor CURSOR FOR ".
- " SELECT custnum FROM cust_main WHERE ". bill_where( %opt )
- ) or die $cursor_dbh->errstr;
+ my $select = 'SELECT custnum FROM cust_main WHERE '. bill_where( %opt );
+
+ unless ( driver_name =~ /^mysql/ ) {
+ $cursor_dbh->do( "DECLARE cron_bill_cursor CURSOR FOR $select" )
+ or die $cursor_dbh->errstr;
+ }