我想知道我是否编写了代码,所以它产生了两个相同的 sql 语句,但是变量名不同的地方会被缓存为同一个语句吗?
例如,如果我有:
Select * from example where id in (:inarg0, inarg1);
Select * from example where id in(:inarg2, inarg3);
更新: 我做了一个函数,它将获取一个数据数组并将其转换为每次调用函数时递增的绑定变量。这很棒有sql注入。我只是希望通过缓存语句也能从中获得一些性能。位置绑定变量不是一个选项,因为该函数与其他可绑定变量(如
Select * from example where name = :name and expt = (:inarg0, inarg1) and date=:todaysDate and loc in (:inarg2, :inarg3, :inarg4)
如果函数要在同一个程序中再次运行,它看起来像这样:
Select * from example where name = :name and expt = (:inarg5, inarg6) and date=:todaysDate and loc in (:inarg7, :inarg8, :inarg9)