In an Oracle Database, what are the differences between the following:
There is an important note to take into account when using the USER function from PL/SQL. As I have documented in this blog post, STANDARD.USER() is implemented as follows:
function USER return varchar2 is
c varchar2(255);
begin
select user into c from sys.dual;
return c;
end;
So, it delegates to evaluating user in the SQL engine, which leads to a hidden PL/SQL to SQL context switch. If you're doing that too often, e.g. from within a trigger, then that can turn out to be quite hurtful in a production system. Try to avoid calling USER() from PL/SQL, and use sys_context('USERENV', 'SESSION_USER') instead.