The below code fails when I try to pass in 3 parameters in the Perl script which connects to a Oracle Database.

Code

my $gen_text = $dbh->prepare(qq(SELECT col1, col2 FROM region WHERE STATUS = 'N' AND PARTITION_KEY IN (SELECT col_1 AS part_key FROM Sched WHERE derivdate = to_date(?,'YYYY-MM-DD') and group = ? and row_number = ?))) or die("Could not get data from table '$_'".DBI->errstr);

There is data in the table when I select the column from the database. Also, the script works when I hardcode the values for derivdate, group and row number. It FAILS when I assign the bind param for the 3 variables. What am I doing wrong on the bind variable assignments?