Data dictionary — meta-data — system & object privileges — dictionary structure — ``user'' tables - ``all'' tables — ``dba'' tables — ``v$'' tables — frequently used tables — usage examples — exercises — using the dictionary in PL/SQL programs — optional exercise.
SQL> SELECT constraint_name, constraint_type, 2 status, table_name 3 FROM user_constraints 4 /
CREATE OR REPLACE PROCEDURE stud_snooper AS attend_lab_1 number; attend_lab_2 number; user_name varchar2(8) := lower(user); BEGIN -- students that attended lab 1 have a 'books' table SELECT count(table_name) INTO attend_lab_1 FROM user_tables WHERE table_name='BOOKS'; dbms_output.put(user_name || ' attendance to Oracle lab. 1: '); -- attend_lab_1 will be either 0 or 1. if attend_lab_1 = 0 then dbms_output.put_line('NO'); else dbms_output.put_line('YES'); end if; -- students that attended lab 2 have a 'welcome' procedure SELECT count(object_name) INTO attend_lab_2 FROM user_objects WHERE object_type='PROCEDURE' AND object_name='WELCOME'; dbms_output.put(user_name || ' attendance to Oracle lab. 2: '); if attend_lab_2 = 0 then dbms_output.put_line('NO'); else dbms_output.put_line('YES'); end if; END; /
Write a program stud_snooper_2 that uses all_tables and all_objects to report all the students that did not attend at least one Oracle lab.