What is the role of REF CURSOR in Oracle and why do we need an SQL Statement i.e.
OPEN c2 FOR sqlstmt USING c3_rec.id;
Here is the cursor code , please help .
TYPE cur_ref IS REF CURSOR;
c2 cur_ref;
sqlstmt VARCHAR2(2000);
total INTEGER;
sqlstmt:='SELECT COUNT(*) total FROM "'||owner||'".'||table||' WHERE '||:NEW.cname||' = :1';
OPEN c1 FOR sqlstmt USING :NEW.min;
BEGIN
OPEN c2 FOR sqlstmt USING c3_rec.id;
FETCH c2 INTO total;
CLOSE c2;
EXCEPTION
WHEN others THEN
error(1006, id: %s %s raised by: %s')