Tags » Cursors

ORACLE: Looping through data using CURSORS

Below the syntax for creating the cursors in Oracle. This example also demostrates creating of procedures in Oracle


CREATE OR REPLACE PROCEDURE MYSCHEMA.GET_EMAILS AS

 EMAIL_ID VARCHAR2(100);
 
 CURSOR CUR IS SELECT EMAIL_ADDRESS FROM MYSCHEMA.USERS; /* DEFINE CURSOR */
 
BEGIN
 
 OPEN CUR; /* OPEN THE CURSOR */
 
 LOOP /* LOOP */
 
 FETCH CUR INTO EMAIL_ID; /* READ THE CURSOR VALUE */
 
 EXIT WHEN CUR%NOTFOUND; /* EXIT WHEN DATA NOT FOUND */
 
 DBMS_OUTPUT.PUT_LINE(EMAIL_ID); /* PRINT THE VALUE / PROCESS ACCORDING TO YOUR NEED */
 
 
 END LOOP; /* END OF LOOP */
 
 CLOSE CUR; /* FINALLY RELASE/CLOSE THE CURSOR */
END;
/

Happy Kooding.. Hope this helps!

Oracle

The Waiting Cursor

I am a writer.

You’ve no idea how long that phrase sat on my screen, the cursor blinking at me while I decided what should come next.  446 more words

Journaralities

Timeless

I have not worn a wristwatch in years. I used to wear watches but stopped when I bought a gold chain and put it on my right hand as I was wearing my watch on my left hand. 168 more words

Of idle users and non-set based solutions

Like many DBAs I support some interesting applications that lead to interesting solutions. One, for example, is a global application where a user many time zones away might lose their connection. 582 more words

Performance difference between Explicit and Implicit Cursors in Oracle PL/SQL

There are many articles over the web about the difference between an explicit and implicit cursor. Theoretically, an implicit cursor is nicer and way faster. For an implicit cursor, Oracle takes care of… 229 more words

Oracle Performance Tuning

esProc External Memory Computing: Basic Usages of the Cursor

esProc supports importing big data in batches with the cursor, which is the usual method used in big data computing. Usages of cursors, including external file cursor, database cursor and in-memory record sequence cursor, are basically the same. 1,705 more words

EsProc

esProc External Memory Computing: Concept of Cursor

The concept of cursor is very important for the database. With the cursor, data can be manipulated more flexibly and returned from the data table by rows. 1,015 more words

EsProc