In Oracle Database, the USER
function returns the name of the session user (the user who logged on).
Syntax
The syntax goes like this:
USER
So, no parentheses or arguments are required (or accepted).
Example
Here’s an example to demonstrate:
SELECT USER FROM DUAL;
Result:
HR
In this case, the current user is HR
.
The actual result will depend on the session user running the query. This may change during the duration of a database session as Real Application Security sessions are attached or detached.
A similar function is the UID
function, which returns the ID of the session user.
Here they are side by side:
SELECT UID, USER FROM DUAL;
Result:
UID USER ______ _______ 138 HR