CRITICAL
Rule Definition
Cursors are loops which number of iterations is based on the number of rows returned by an SQL query. Having a cursor inside a loop means having an SQL query inside a loop which number of iterations can be very high (dependent on the data returned from the database).
This iterative pattern has proved to be very dangerous for application performance and scalability. Database servers handle in a much better set-oriented pattern rather than pure iterative ones.
Remediation
The remediation is often to replace the iterative approach with a set-oriented one and thus replace a cursor with a query.
Related Technologies
PL/SQL
Microsoft T-SQL
Sybase T-SQL
Technical Criterion
CWE-1050 - Excessive Platform Resource Consumption within a Loop
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.