Referring to tables owned by groups

Groups are used for finding tables and procedures in the database. For example, the following query always finds the view SYS.SYSGROUPS, because all users belong to the PUBLIC group, and PUBLIC belongs to the SYS group which owns the SYSGROUPS view:

SELECT * FROM SYSGROUPS;

The SYSGROUPS view contains a list of group-name, member-name pairs representing the group memberships in your database.

If a table named employees is owned by the user ID personnel, and if M_Haneef is a member of the personnel group, then M_Haneef can refer to the employees table simply as employees in SQL statements. Users who are not members of the personnel group need to use the qualified name personnel.employees.

Creating a group to own the tables

A good practice to follow, that allows everyone to access the tables without qualifying names, is to create a group whose only purpose is to own the tables. Do not grant any permissions to this group, but make all users members of the group. You can then create permission groups and grant users membership in these permission groups as warranted.

If a user owns a table that has the same name as a table owned by a group, using the unqualified table name refers to the table owned by the user, not the one owned by the group. As well, if a user belongs to more than one group that has a table with the same name, the user must qualify the table name.

See Database object names and prefixes.