UID – Return the ID of the Current Session in Oracle

In Oracle Database, the UID function returns an integer that uniquely identifies the session user (the user who logged on).

Syntax

The syntax goes like this:

UID

So yes, it’s very simple!

Example

Here’s an example to demonstrate:

SELECT UID FROM DUAL;

Result:

138

Obviously, the actual result will depend on the session user running the query.

A similar function is the USER function, which returns the name of the session user.

Here they are side by side:

SELECT UID, USER FROM DUAL;

Result:

   UID    USER 
______ _______ 
   138 HR