Categories:

Context Functions (Session Object)

CURRENT_SCHEMA¶

Returns the name of the schema in use by the current session.

To specify a different schema for the session, execute the USE SCHEMA command.

Syntax¶

CURRENT_SCHEMA()
Copy

Arguments¶

None.

Usage Notes¶

Do not confuse this function with the similarly named function CURRENT_SCHEMAS.

Examples¶

Show the current warehouse, database, and schema:

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

Output:

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