Oracle: Delete row in a table using triggers while deleting value in another table
You can't select or modify the underlying table of the trigger during trigger processing.  In this case, you are selecting.

Don't perform this work in a trigger.  Manage the delete in PL/SQL application code where you can perform the delete, count for the children, and then delete the parent when there are no children.  Basically what I'm interpreting your logic to be.