Question: How can I get the name of the Oracle database instance that I'm connected to through an SQL statement?
Answer: You can retrieve the instance name using the sys_context function.
To retrieve the Oracle instance name, you execute the following SQL statement:
select sys_context('USERENV','DB_NAME') as Instance from dual;
It should return something like this:
INSTANCE -------------------------------------------------------------------------------------- DBPROD