Oracle / PLSQL: USER function (Retrieving username)
This Oracle tutorial explains 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 current 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 function 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 function examples and explore how to use the USER function 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 contain the Oracle user ID from the current Oracle session.
Advertisements