I am executing my script on the command line with parameter ('?') values for $firstday and $lastday. I am passing values sysdate-60 and sysdate for these 2 values of '?' These values are called from a oracle database function of a DATE datatype. But the script is failing with on a non-numeric character found on '?'. When I run the SELECT query by itself on the database, it works and returns rows.
Is the way I have written the prepare statement in call a database function date parameter, the issue?
My prepare and bind/execute statements are:
my ($db, $user, $pw, $wkdir, $firstday, $lastday) = @ARGV;
my $gen_text = $dbh->prepare(qq(SELECT col1, col2, col3 FROM region WHERE status = 'Y' and partition_key = (Select common.get_region('REGION',?, ?) from dual)))
or die("Could not get data from table '$_'".DBI->errstr);