Answer the question
In order to leave comments, you need to log in
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
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.
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 questionAsk a Question
731 491 924 answers to any question