Duplicate Activities causing query to fail when trying to delete.

Duplicate Activities causing query to fail when trying to delete.

When attempting to delete an Activity, the user receives an error message.  When tapping "View Details" on the error message, the user receives the below message of "More than one result was returned from Query.getSingleResult".

The cause of the duplicates has not been addressed.  Follow the below procedure to manually check and delete the duplicate from the database.

Step-1: Open the HANA Database Explorer using the link: SAP HANA Database Explorer for SAP HANA Cockpit

Step-2: Open the list of tables and search for the table TAE_TURNAROUND to get the information about the turnaround in question.


After the explorer is open from the left open the first database and right-click on Tables then click on Show Tables.



In the list of tables search for TAE_TURNAROUND on the top right search bar.

Validate the Schema Name to be USR_BOKFEKW1UQIR49ZB0UMWNTMFE and look for the Table name and right click and select Open Data.



Step-3: Find the required Turnaround Id.

Compare with the TUNRAROUND_NAME and copy the corresponding TURNAROUND_ID.



Step-4: Run a qery to get duplicate activities.

'6d32f860-c786-4fc4-9053-8dff9568ea7a' AND DELETED = 0 GROUP BY ACTIVITY_ID HAVING COUNT(ACTIVITY_ID) > 1;

Replace the text in red with the copied TURNAROUND_ID.



Click run and you should see the activities that are duplicated for that Turnaround.

Step-5: Delete/Change them one-by-one.

Open the Table TAE_ACTIVITY and Open Data and paste a selected activity id in the Search, it should display all the duplicated copies.





To Delete: To delete an activity set the deleted to 1 by clicking once in the cell to enter edit mode and set it to 1 and hit save.





To Keep Both Activities: Again enter edit mode this time on the ACTIVITY_ID column and change a number the id ranges from 1-9 and a-e. Hit save to save the new activity id.





Step-6: Run the same query to verify all duplicates have been deleted/changed.

From the SQL Console execute the same query and verify that this time there are 0 rows in the output.