anchor.diff:              {ResultName, ReadOnly, RestFields} = find_original_field(Alias, Fields),
               {ResultName, ReadOnly, [OrigField | RestFields]}
       end.
  +
  +-spec parse_sql(tuple(), binary()) -> {binary(), binary(), binary(), boolean(), list()}.
  +parse_sql({ok, [{{select, SelectSections},_}]}, Sql) ->
  +    {TableName, NewSql, RowIdAdded} = inject_rowid(select_type(SelectSections), SelectSections, Sql),
  +    {Sql, NewSql, TableName, RowIdAdded, SelectSections};
  +parse_sql({ok, [{{'begin procedure', _},_}]}, Sql) ->
  +    %% Old sql is replaced by the one with the correctly added semicolon, issue #401
  +    NewSql = append_semicolon(Sql, binary:last(Sql)),
  +    {NewSql, NewSql, <<"">>, false, []};
  +parse_sql(_UnsuportedSql, Sql) ->
  +    {Sql, Sql, <<"">>, false, []}.
  
positive.code: run_query(Connection, Sql, Binds, NewSql, RowIdAdded, SelectSections) ->
      %% For now only the first table is counted.
      case Connection:prep_sql(NewSql) of
          {error, {ErrorId,Msg}} ->
              case Connection:prep_sql(Sql) of
                  {error, {ErrorId,Msg}} ->
                      error({ErrorId,Msg});
  
negative.code:                     result_exec_stmt(StmtExecResult,Statement,Sql,Binds,NewSql,RowIdAdded,
                                       Connection,SelectSections)
              end;
          {error, {ErrorId,Msg}} -> error({ErrorId,Msg});
          Statement ->
              StmtExecResult = bind_exec_stmt(Statement, Binds),
              result_exec_stmt(StmtExecResult,Statement,Sql,Binds,NewSql,RowIdAdded,Connection,
  