Oracle / PLSQL: USER function (Retrieving username)

This article is written about how to return the user_id in Oracle/PLSQL with syntax and examples.

Description

The Oracle/PLSQL USER function returns the user_id from the cutting-edge Oracle session.

Syntax

The syntax for the USER function in Oracle/PLSQL is:

USER

Parameters or Arguments

There are no parameters or arguments for the USER function.

Returns

The USER function returns a string value.

Applies To

The USER feature can be used in the following versions of Oracle/PLSQL:

Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i, Oracle 8i

Example

Let’s look at some Oracle USER characteristic examples and explore how to use the USER characteristic in Oracle/PLSQL.

For example:

parm_user_ID := USER;

OR

select USER
into parm_user_ID
from dual;

The variable called parm_user_ID will now comprise the Oracle consumer ID from the current Oracle session.