Sean Lange (10/31/2012)
Mackers (10/31/2012)
Hi Chris,The SQL is quite hard to read (and I have never come across case statements & cursors used like that before) but rather than using a cursor couldn't you write this as a SQL statement doing outer joins on the tables to achieve the same results?
To be honest I only every really use cursors for breaking large transactions into smaller ones (inserting data per month etc).
In answer to your question I guess you could insert you results into a temp table than report from that(?)
Mack
Next time you feel you need a cursor for this type of an operation, start a new post on SSC. From the description I doubt you need a cursor for that type of thing either. 😛
Unlike to SQL Server, ORACLE cursors usually do not have performance problems. However, I've seen few cases where rewriting CURSORS into set-based queries did bring some performance benefits even in Oracle.