In Oracle, the SYS_CONTEXT function retrieves session and system information from the specified namespace.
In MySQL, you need to use dedicated functions to retrieve each piece of session or system information.
Oracle:
-- Get the current user SELECT SYS_CONTEXT ('USERENV', 'SESSION_USER') FROM dual;
MySQL:
-- Get the current user SELECT USER();
Mapping SYS_CONTEXT parameters:
| Oracle | MySQL | |||
| 1 | SYS_CONTEXT ('USERENV', 'OS_USER') | Get OS user | USER() | Returns database user |
| 2 | SYS_CONTEXT ('USERENV', 'SESSION_USER') | Get the current user | USER() | |
For more information, see Oracle to MySQL Migration.