Question

I'm getting following error while trying to execute a a sql which is formed by joining few variables.

DBD::ODBC does not yet support binding a named parameter more than once

I can execute the same sql from sql prompt without any issues!!

my code goes likes this: (DBI connection, datetime $format, all variables used are already created in previous steps)

$sql = "";
my $param1 = $format->parse_datetime($dateval->ymd('-'));
$param1->add(days => 1);
$sql = crt_view($param1,$param2,$param3,$param4); #crt_view is function which will return a segment of my sql for the parameters passed
$sqlins = "create or replace view v_tabl_xxx as ".$sql;
$sth = $dbi->prepare($sqlins);
$sth->execute() or die("[ERROR] : \n\t$DBI::errstr\n");
Was it helpful?

Solution

Sounds like it is interpreting part of your SQL as named placeholders when it shouldn't. Try doing

$dbi->{odbc_ignore_named_placeholders} = 1;

first.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top