Categories:
Context Functions (Session Object)

CURRENT_DATABASE

Returns the name of the database in use for the current session.

To specify a different database for the session, execute the USE DATABASE command.

Syntax

CURRENT_DATABASE()

Arguments

None.

Examples

Show the current warehouse, database, and schema:

SELECT CURRENT_WAREHOUSE(), CURRENT_DATABASE(), CURRENT_SCHEMA();

Output:

+---------------------+--------------------+------------------+
| CURRENT_WAREHOUSE() | CURRENT_DATABASE() | CURRENT_SCHEMA() |
|---------------------+--------------------+------------------|
| DEV_WAREHOUSE       | TEST_DATABASE      | UDF_TEST_SCHEMA  |
+---------------------+--------------------+------------------+