Home > Database > Mysql Tutorial > Detailed introduction to cursor data

Detailed introduction to cursor data

零下一度
Release: 2017-06-10 15:21:11
Original
1569 people have browsed it

Using cursor data After a cursor is opened, you can use the FETCH statement to access each row of it separately. FETCH specifies what data (required columns) to retrieve and where the retrieved data is stored. It also moves the internal row pointer in the cursor forward so that the next FETCH statement retrieves the next row (without reading the same row repeatedly). First example retrieves a single row (first row) from the cursor: Input: create procedure processorders() BEGIN -- declare local variables declare o int; -- declare the cursor declare ordernumbers cursor for select order_num from orders: -- o

1. MySQL using cursor data instance tutorial

Detailed introduction to cursor data

##Introduction: Using Cursor Data After a cursor is opened, you can use the FETCH statement to access each of its rows separately. FETCH specifies what data (required columns) to retrieve and where the retrieved data is stored. It also moves the internal row pointer in the cursor forward so that the next FETCH statement retrieves the next row (without reading the same row repeatedly). The first example retrieves a single row (the first row) from the cursor:

2. Cursor-based positioning DELETE/UPDATE statement

Introduction: If the cursor is updatable (that is, the Read Only parameter is not included in the definition cursor statement), you can use the cursor to DELETE/UPDATE rows from the source table of the cursor data, that is, DELETE/ UPDATE operation based on the current position of the cursor pointer; Example: --Delete the record of the current row Declare cur_Depart Cursor For Select cDeptID,cDeptN

[Related Q&A recommendations]:

java - spring calls the stored procedure and returns the cursor. When the cursor data exceeds the specified size of the connection pool, the connection pool explodes

The above is the detailed content of Detailed introduction to cursor data. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template