With that said, let’s look into how cursors work and see some examples. So, before you use a cursor for all of your code, consider if there is another way to do it. Processing batches of records to reduce the impact of locks on tables.Executing stored procedures in some situations.Calculating a running total (which may be faster).However, there are some situations where a cursor is useful: Complex logic which could be done using a CASE statement.Selecting data from multiple tables which can be done using joins.
SQL CURSOR UPDATE
![sql cursor sql cursor](https://codingsight.com/wp-content/uploads/2020/12/image-105.png)
However, in SQL, data is processed in a set. It looks at each record inside a set individually.
![sql cursor sql cursor](https://docs.oracle.com/cd/B19306_01/appdev.102/b14261/ref_cursor_type_definition.gif)