ceu-notes/2/ASGBD/samples/alter-table-script.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

14 lines
479 B
SQL

DECLARE
tbl_name USER_TABLES.TABLE_NAME%type;
CURSOR table_cursor IS SELECT TABLE_NAME FROM USER_TABLES;
BEGIN
OPEN table_cursor;
LOOP
FETCH table_cursor INTO tbl_name;
EXIT WHEN table_cursor%NOTFOUND;
dbms_output.put_line('ALTER TABLE ' || tbl_name || ' ADD fecha_creacion DATE;');
dbms_output.put_line('ALTER TABLE ' || tbl_name || ' ADD usuario_creacion VARCHAR2(32);');
END LOOP;
CLOSE table_cursor;
END;
/