File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -246,3 +246,34 @@ SELECT * FROM TABLE1 RIGHT JOIN TABLE2 ON condition;
246246SELECT select_list from TABLE1 CROSS JOIN TABLE2;
247247` ` `
248248
249+
250+ # # Cursors
251+
252+ When an MYSQL statement is processed, a memory area is created known as context area. A cursor is a pointer to this context area.
253+
254+ # ## There are two types of cursor
255+ # ### 1. Implict cursor
256+ # ### 2. Explict cursor
257+
258+
259+ # ## Explict Cursor
260+ Explict cursors are used when you are exceuting a SELECT statement query that will return more than one row.
261+
262+ # ## The cursor works in four stages
263+
264+ # ## 1. Declaration of cursor:-
265+ ` ` ` sql
266+ DECLARE cursor_name CURSOR FOR SELECT_statement;
267+ ` ` `
268+ # ## 2. Open Cusor
269+ ` ` ` sql
270+ OPEN cursor_name;
271+ ` ` `
272+ # ## 3. Fetch the cursor
273+ ` ` ` sql
274+ FETCH cursor_name INTO variables list;
275+ ` ` `
276+ # ## 4. Close the cursor
277+ ` ` ` sql
278+ CLOSE cursor_name;
279+ ` ` `
You can’t perform that action at this time.
0 commit comments