W
W
weranda2021-04-14 18:55:42
JavaScript
weranda, 2021-04-14 18:55:42

What is a cursor in databases?

Greetings.
Can you explain in simple terms what a cursor is in databases so that it becomes clear once and for all?
The wiki has this information, but it's written rather incomprehensibly.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
cicatrix, 2021-04-14
@cicatrix

Let's try it with my fingers. Imagine you have a multi-storey warehouse (table). Boxes (data) are stored on each floor. To get to the data (SELECT), you need to take the elevator to the desired floor and get (FETCH) these boxes. Here is the elevator - this is your cursor, if everything is very, very simplified.

D
d-stream, 2021-04-14
@d-stream

In fact, the cursor is an opportunity to implement a cycle on some kind of selection cast. With a bunch of ruffles. Including take into account or not take into account at each step of the cycle changes from past steps.
You can almost always use a temporary table instead of a cursor (local, global, memory)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question