When should we use the sql cursor

Hi everyone, tell me when should I use the cursor?

thanks Saj

+3
source share
3 answers

Ideally, as little as possible. Cursors have fairly high processing overheads.

Or when

  • The process you are running cannot be rewritten as a collection-based operation. (For example, call DBCC DBREINDEX in turn in the table list)
  • Set-based operation has the worst asymptotic complexity. To run aggregates, a solution based on a set has quadratic complexity, while the cursor's workload grows linearly.

SQL CLR- , .

+7

Oracle:

EXPLICIT CURSORS WITH IN SQL * FORMS 3.0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~

. , , .

- SQL. PL/SQL ( 2-16):

, :

  • ,
  • , .

SELECT .

, . , . , .

-1

Source: https://habr.com/ru/post/1762036/


All Articles