1

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");
MikA
  • 5,184
  • 5
  • 33
  • 42
  • 1
    what is the value of `$sql`? – mob Jun 18 '13 at 19:44
  • $sql gets value from function crt_view(arg1,arg2,arg3,arg4), the final values in $sql is DDL of a view which works without any issues from sql editors. for you reference the values is like this: **CREATE OR REPLACE VIEW v_tabl_xxx AS SELECT id, mid, NVL(val,'-1') AS val, "TIME", EXP(-1.0*(MINUTES_BETWEEN("TIME",'2013-05-26'))/1440)::REAL AS delay FROM tabl_xxx_201303 WHERE "TIME" >= '2013-03-05' UNION ALL SELECT id, mid, NVL(val,'-1') AS val, "TIME", EXP(-1.0*(MINUTES_BETWEEN("TIME",'2013-05-26'))/1440)::REAL AS delay FROM tabl_xxx_201304** – MikA Jun 18 '13 at 19:53

1 Answers1

4

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.

ysth
  • 96,171
  • 6
  • 121
  • 214