1: difference between implicit cursor and display cursor
* No need to declare a cursor
* No need to open or close the cursor
* The INTO clause must be used. Only one INTO clause can be returned.
2: Similarities between an implicit cursor and a display cursor
Same attributes
3: Small Example
DECLARE
Name VARCHAR2 (50 );
Department_name varchar (20 );
BEGIN
SELECT name, department_name
INTO name, department_name
FROM employees e, departments d
WHERE e. department_id = d. department_id and e. id = 1;
Dbms_output.put_line (name | 'in' | department_name );
END;
4: Implicit cursors use attributes
Syntax:
SQL % isopen SQL % found SQL % NOTFOUND
SQL % ROWCOUNT -- usually used to determine whether insertion, update, and deletion are successful, but before the COMMIT statement
Attribute use instance:
BEGIN
UPDATE employees SET name = name | 'A' WHERE id = 7;
If SQL % ROWCOUNT = 1 THEN -- SQL % FOUNF can also
DBMS_OUTPUT.PUT_LINE ('table updated ');
ELSE
DBMS_OUTPUT.PUT_LINE ('No. Not found ');
End if;
END;