---
title: "Concept of cursor in database?"  
description: "Concept of cursor in database?"  
author: "Anonymous User"  
published: 2010-10-20  
updated: 2020-09-23  
canonical: https://www.mindstick.com/interview/61/concept-of-cursor-in-database  
category: "mssql server"  
tags: ["mssql server"]  
reading_time: 1 minute  

---

# Concept of cursor in database?

Cursors provide a mechanism by which a database client iterates over the records in a database. Using cursors, the client can get, put, and delete database records. Database programmers use cursors for processing individual rows returned by the database system for a query.\
\
Working with cursor:\
Syntax:\
Declare a cursor\

```
DECLARE cursor_name CURSOR FOR SELECT ... FROM ...
Open a cursor
OPEN cursor_name
Fetch Cursor
FETCH cursor_name INTO ...
Close Cursor
 CLOSE cursor_name
```

\

## Answers

### Answer by Rajesh Goswami

Cursors provide a mechanism by which a database client iterates over the records in a database. Using cursors, the client can get, put, and delete database records. Database programmers use cursors for processing individual rows returned by the database system for a query.\
\
Working with cursor:\
Syntax:\
Declare a cursor\

```
DECLARE cursor_name CURSOR FOR SELECT ... FROM ...
Open a cursor
OPEN cursor_name
Fetch Cursor
FETCH cursor_name INTO ...
Close Cursor
 CLOSE cursor_name
```

\


---

Original Source: https://www.mindstick.com/interview/61/concept-of-cursor-in-database

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
