Name

bind_param_inout

Synopsis

$rc = $sth->bind_param_inout($p_num, \$bind_value, $max_len) ||
die $sth->errstr;
$rv = $sth->bind_param_inout($p_num, \$bind_value, $max_len,
\%attr) || ...
$rv = $sth->bind_param_inout($p_num, \$bind_value, $max_len,
$bind_type) || ...

This method acts like bind_ param , but also enables values to be updated by the statement. The statement is typically a call to a stored procedure. The $bind_value must be passed as a reference to the actual value to be used.

Note that unlike bind_ param, the $bind_value variable is not read when bind_ param_inout is called. Instead, the value in the variable is read at the time execute is called.

The additional $max_len parameter specifies the minimum amount of memory to allocate to $bind_value for the new value. If the value returned from the database is too big to fit, then the execution should fail. If unsure what value to use, pick a generous length, i.e., a length larger than the longest value that would ever be returned. The only cost of using a larger value than needed is wasted memory.

It is expected that few drivers will support this method. The only driver currently known to do so is DBD::Oracle (DBD::ODBC may support it in a future release). Therefore, it should not be used for database-independent applications.

Undefined values or undef are used to indicate null values. See also "Placeholders and Bind Values” for more information.

Get Programming the Perl DBI now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.