Ownership of Created Database Objects
The user who creates an owner-privileged UDR, rather than the user who executes the UDR, owns any database objects that are created by the UDR when the UDR is executed, unless another owner is specified for the created object.
For example, assume that user mike creates this user-defined
function:
CREATE FUNCTION func1 () RETURNING INT;
CREATE TABLE tab1 (colx INT);
RETURN 1;
END FUNCTION;
If user joan now executes function func1, user mike, not user joan, is the owner of the newly created table tab1.
In the case of a DBA-privileged UDR, however, the user who executes a UDR (rather than the UDR owner) owns any database objects created by the UDR, unless another owner is specified for the database object within the UDR.
For example, assume that user mike creates this user-defined
function:
CREATE DBA FUNCTION func2 () RETURNING INT;
CREATE TABLE tab2 (coly INT);
RETURN 1;
END FUNCTION;
If user joan now executes function func2, user joan, not user mike, is the owner of the newly created table tab2.
See also the section Support for roles and user identity.