DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: cursor VS select stmt

  1. #1
    Join Date
    Sep 2000
    Posts
    77

    cursor VS select stmt

    A table has a id column as primary key. Which of the following is the best way to select from that table using id column?
    1. Select stmt with a where clause on id column
    2. Cursor with select stmt with a where clause on id column
    I know for the first I need to catch WHEN NO_DATA_FOUND exception.
    For performanance reasons which one is better a cursor or a stand alone select stmt with no_data_found exception. Can someone please advise.
    Thanks,

  2. #2
    Join Date
    Aug 2002
    Location
    Colorado Springs
    Posts
    5,253
    Do you mean an explicit cursor? As a rule I'd just do whichever is the most simple to write and understand ... for that reason I'd rule out explicit cursors and just do the select, and catch the exception.
    David Aldridge,
    "The Oracle Sponge"

    Senior Manager, Business Intelligence Development
    XM Satellite Radio
    Washington, DC

    Oracle ACE

  3. #3
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092
    A simple SELECT is always faster than a cursor, except when it's not.
    Jeff Hunter

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width