Why doesn't PL/SQL respect privileges granted by Roles?

Solution 1:

It's probably a combination of laziness and the SET ROLE command.

I disagree that it's not allowed because of complex dependencies. Oracle already manages complex dependencies. And in 12c it is possible to grant a role to an object.

I think the real reason why objects don't inherit the roles of the user is because of the SET ROLE command. It's possible for a user to be assigned a role but to turn it on and off within a session. That's a silly feature and I've never seen it used. But theoretically it would require recompiling within the same session or transaction, which would be really confusing.

Solution 2:

Otherwise if you drop a role then the PL/SQL package would become INVALID in some cases (without having the option to re-compile).

DROP ROLE ... is a DCL (Data Control Language) statement. Looks like Oracle decided: "A PL/SQL package shall not become INVALID by a DCL statement"