|
Declare, Open, Fetch, Close. An explicit cursors are used to process multirow SELECT statements An implicit cursor is used to process INSERT, UPDATE, DELETE and single row SELECT. .INTO statements. What are cursor attributes ? %ROWCOUNT, %NOTFOUND, %FOUND, %ISOPEN What is a cursor for loop ? Difference between NO DATA FOUND and %NOTFOUND ? NO DATA FOUND is an exception raised only for the SELECT....INTO statements when the cursor does not match any rows the %NOTFOUND attribute is set to TRUE instead. What a SELECT FOR UPDATE cursor represent ? declaration statement. What 'WHERE CURRENT OF ' clause does in a cursor ? LOOP SELECT num_credits INTO v_numcredits FROM classes WHERE dept=123 and course=101; UPDATE students SET current_credits=current_credits+v_numcredits WHERE CURRENT OF X; END LOOP COMMIT; END; What is use of a cursor variable? How it is defined ? cursor variable is reference type(like a pointer in C). TYPE type_name IS REF CURSOR RETURN return_type type_name is the name of the reference type,return_type is a record type indicating the types of the select list that will eventually be returned by the cursor variable. What should be the return type for a cursor variable. Can we use a scalar data type as return type ? The return type for a cursor must be a record type.It can be declared explicitly as a user-defined or %ROWTYPE can be used. eg TYPE t_studentsref IS REF How you open and close a cursor variable.Why it is required ? |