Oracle Error ORA-36165: (XSAGGCNTPROP) Variable workspace object cannot have both an AGGCOUNT and the $COUNTVAR property.

Oracle Error Message

ORA-36165: (XSAGGCNTPROP) Variable workspace object cannot have both an AGGCOUNT and the $COUNTVAR property.

Reason for the Error

An attempt was made to add the $COUNTVAR property to a variable which already had an AGGCOUNT, or vice versa.

Solution

Delete the already existing $COUNTVAR property or AGGCOUNT first.