bingley dating - Cursor and updating same records inside cursor
The DECLARE statement declares a cursorand associates it with a SELECT statement that retrieves the rows to be traversed by the cursor.
Also keep in mind that the cursor SELECT statement cannot have an INTO clause; it's strictly read-only.
While we won't be looking at the use of multiple cursors within the same stored proc, it is entirely possible to have multiple cursors in the same code block, but each cursor must have a unique name. HANDLER statement specifies a handler that deals with one or more conditions.
************************ Use the select statement below to select duplicated records insert into YOUR_TEMP_TABLE select * from YOURTABLE where rowid in ( select rowid from YOURTABLE minus select min(rowid) from YOURTABLE group by YOURCOLUMN ) ; Put the result into a temporary loading table. Use CURSOR FOR LOOP and then inside it use FOR LOOP.
Use a counter which can also be used to append to your YOURCOLUMN declare counter number(10) := 0; mycount number(10) := 0 ; cursor my_cursor is select * from YOUR_TEMP_TABLE ; begin for my_rec in my_cur loop select count(1) into mycount from YOURTABLE where YOURCOLUMN = my_rec.
If one of these conditions occurs, the specified statement executes.