CURRENT_SCHEMA
CURRENT_SCHEMA is a SQL function that returns the name of the current schema. In SQL, a schema is a collection of database objects that include tables, views, indexes, and procedures. The CURRENT_SCHEMA function is handy for determining the schema that is currently being utilized in a session. The return type of this function is a string representing the current schema's name.
CURRENT_SCHEMA()
Example
Output
Explanation
In the example, a new schema named ‘tech’ is created. After that, the search path is set to ‘tech’, effectively making it the current schema. The CURRENT_SCHEMA
function is then used to return the name of the current schema, which is ‘tech’.
CURRENT_SCHEMA
Example
Output
Explanation
The above SQL code retrieves the current schema in an Oracle database. The output ‘HR’ indicates that the current schema in use is ‘HR’.