[3TV] Error when running select
Problem
In some cases when trying to run 3ptv view. You might encounter an error as seen below:
select * from [3PTV]
Msg 512, Level 16, State 1, Line 1
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
Solution
The issue occur due to duplicate entry for [User Count (DBA Users)],
- It can be identified by running
select ApplicationID,Count(TableName ) as [Count] from OracleCounts where TableName ='All Users' group by ApplicationID having Count(TableName ) >1
In ideal world the query result should be 0. However while the problem exists
ApplicationID Count 338 2 You need to check the entry to verify to duplicate entry by running:
select * from OracleCounts where TableName ='All Users' and ApplicationID =338
OracleCountsID ApplicationID TableName Count 1 338 All Users 48 3292 338 All Users 48 Line 1 and line Line 2 are duplicates. Hence by removing the older entry the issue can be resolved.
delete from OracleCounts where OracleCountsID =1
Related articles