SQL error message 'Multiple rows in a singleton select'
This article has not been rated yet. After reading, feel free to leave comments and rate it.
Question:I need to know how to resolve an exception that says 'Multiple rows in a singleton select'
Answer:This error message happens when you have a select statement (in a stored procedure) that you expected to return one row but (because of erronous data?) it returns multiple rows.
where cust_id = 1234
This works fine until you have two records with cust_id = 1234.
If you are in a situation like me (a project with 150 stored procedures totalling 40,000 lines of brainless SQL) then this may be hard to find. Once you know which stored procedure, you can try changing your statements by putting them temporarily into FOR loops: