Why do I get a "transaction already started" error when calling a procedure?
This often happens if the procedure mixes INSERT
or UPDATE
and SELECT
statements, and AUTOCOMMIT
is turned off. This is quite a common question from people using Perl where the script connects with AUTOCOMMIT
turned off. For example:
my $dbh = DBI->connect($ENV{DBI_DSN},
$ENV{DBI_USER},
$ENV{DBI_PASS},
{
RaiseError => 1,
AutoCommit => 0
}
) || die "Database connection failed: $DBI::errstr"