ceu-notes/2/ASGBD/samples/count-plsql.sql
Nicolás A. Ortega Froysa 78442e5fc1 ASGBD: add SQL samples
Signed-off-by: Nicolás A. Ortega Froysa <nicolas@ortegas.org>
2023-02-10 19:37:15 +01:00

16 lines
368 B
SQL

DECLARE
office_id oficina.codigo_oficina%type;
cnt INT;
CURSOR my_cursor IS
SELECT codigo_oficina FROM oficina;
BEGIN
cnt := 0;
OPEN my_cursor;
LOOP
FETCH my_cursor INTO office_id;
EXIT WHEN my_cursor%NOTFOUND;
cnt := cnt + 1;
END LOOP;
dbms_output.put_line(cnt);
CLOSE my_cursor;
END;