def METHOD_NAME(errata_id):
    """
    Remove errata from database
    This takes care of the following operations:
      * delete all the packages associated with the errata from rhnErrataPackage
      * delete all the files associated with the errata from rhnErrataFile
      * delete all entries from rhnErrataCloned related with the errata
      * finally delete errata from rhnErrata.
    """
    # delete all packages from errata
    h = rhnSQL.prepare("""
        SELECT rhnPackage.id FROM rhnPackage
         LEFT OUTER JOIN rhnErrataPackage ep on ep.package_id = rhnPackage.id
         WHERE ep.errata_id = :errata_id
    """)
    h.execute(errata_id=errata_id)
    package_ids = [x['id'] for x in h.fetchall_dict() or []]
    for package_id in package_ids:
        package_helper.delete_package(package_id)
    h = rhnSQL.prepare("""
        DELETE FROM rhnErrataPackage ep
         WHERE ep.errata_id = :errata_id
    """)
    h.execute(errata_id=errata_id)
    # delete files from errata
    h = rhnSQL.prepare("""
        DELETE FROM rhnErrataFile
         WHERE errata_id = :errata_id
    """)
    h.execute(errata_id=errata_id)
    # delete errata
    # removed also references from rhnErrataCloned
    # and rhnServerNeededCache
    h = rhnSQL.prepare("""
        DELETE FROM rhnErrata
         WHERE id = :errata_id
    """)
    h.execute(errata_id=errata_id)