• Eric Russell 13013 (9/17/2010)


    Most Oracle developers love cursors. I mean, it's so obvious they're in love. If you read an Oracle PL/SQL developer guide, it will be full of sappy love poetry dedicated to the art of writing cursors.

    This is a tricky one.

    It might be true that some developers love cursors - probably developers with strong mainframe procedural programming languages background. Cursors usually allow for a direct translation of poorly defined business rules.

    On the other hand, cursors force row-based processing which usually performs horrible. Best practice is to design back-end code to take advantage of set-based data processing; avoiding this way the use of cursors.

    Last but not least, cursors are a powerfull tool but it has to be used when needed rather than relying on cursors as the preferred development approach.

    Just remember Rule #5 which states that DBA are responsible for Database performance then, your job as a DBA is to be sure no unnecesary use of cursors makes it to production environment. In most serious Oracle shops DBA still have the power to validate/improve/reject bad code.

    Hope this clarifies a bit.

    _____________________________________
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at Amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.