Name

execute( )

Synopsis

$statement_handle->execute( )

This executes a statement handle that has been processed with the prepare( ) method. There are no arguments to this function.

 . . .
my $dbh = DBI->connect ("$data_source","$user","$pwd")
my $sql_stmnt = "SELECT * FROM books";
my $sth = $dbh->prepare($sql_stmnt);
$sth->execute( );

Although this excerpt will execute the given statement, it will not display the results. To do this, a method like fetchrow_array( ) is needed.

Get MySQL in a Nutshell 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.