At what point i should use cursors with procedures, i searched for an examples of procedures without cursors in net, but everywhere i got procedures with cursors only.Why people are using cursors for simple operations i didnt get that. Though im new to oracle i didnt get the use of cursors.
Thanks in advance
Edited by: im_asa on Oct 29, 2012 8:49 PM
If you are using "SELECT INTO" in procedure and you are not sure if the selected table will return a single row then you should use cursor. "SELECT INTO" can only handle a single row hence a cursor is used to handle if more than one row is return.
IN otherword, the procedure will throw an error if two records is return in a "SELECT INTO" statement.
Cursor is also a controlled mechanism if you are trying to process multiple records one by one where the value of each record will need to be evaluated prior to processing it.