On Thu, May 10, 2007 at 02:50:10PM +0200, Peter J. Holzer wrote: > On 2007-05-10 07:50:16 -0400, Jeffrey Seger wrote: > > On your execution without a bound value, are you actually looking for rows > > where the empno column is null? If so, try this: > > > > instead of > > my @bind1 = (); > > try: > > my @bind1 = (undef); > > > > Otherwise, what exactly are you looking for? > > As I understood Ramesh, the code wasn't supposed to do anything useful. > He expected an error (e.g. "DBD::Oracle::st execute failed: called with > 0 bind variables when 1 are needed"), but instead got a result. > > While the behaviour is documented (if you read closely enough), and also > useful, it is somewhat surprising: > > When you use 2 placeholders in your query, and then invoke execute with > 1 or 3 parameters, you get an error, that the number of bind variables > doesn't match the prepared query. But if you invoke execute with 0 > parameters, you don't get such an error. > > I don't see how this behaviour could be changed without breaking > existing code, though.
It can't as there's no way [*] for the execute() to distinguish between $sth->execute() and $sth->execute(@empty_array). Tim. [*] Well, no sufficiently easy way. I could write the C code to dig through perls internal op tree to see if there was an argument array, but that seems like more pain than gain. Patches welcome, naturally.