Returns the username of the user which was used to run the query on the data source.

Syntax


SELECT SYSTEM_USER FROM { objectName | query } ;

Arguments

  • objectName: The qualified name of an object with a current connection.

  • query: A query which can be executed against a data source.

Examples

Returns the Oracle username used to connect to the system

SELECT SYSTEM_USER FROM ORACLE1.oracle.tpch.nation ; 

Returns the MySQL username where the return operation occurred

SELECT SYSTEM_USER FROM ORACLE1.oracle.TPCH.NATION a
JOIN MYSQL1.tpch.tpch.nation b
ON a.n_nationkey=b.n_nationkey ;

Returns the Oracle username because the subselect runs on oracle

SELECT a.SYSTEM_USER1 FROM
(SELECT SYSTEM_USER AS SYSTEM_USER1, * FROM ORACLE1.oracle.TPCH.NATION) a
JOIN MYSQL1.tpch.tpch.nation b ON a.n_nationkey=b.n_nationkey ;