execute runs the SQL query and returns the number of rows affected. execute is called after a prepare statement and can include data to replace any placeholders in the SQL statement.
Examples:
$sql1 = qq{SELECT * FROM library}; $sql2 = qq{INSERT INTO library (title, author, price) VALUES (?, ?, ?)}; $handle1 = $db_handle->prepare($sql1); $handle2 = $db_handle->prepare($sql2); my $rows1 = $handle1->execute; my $rows2 = $handle2->execute("Evil Empires for Dummies", "Bill Gates", 12.95);
These examples show how to call execute alone and also with placeholders. The values in $rows are the number of rows affected by the respective SQL statement.