Skip to main content

current_path

1. CURRENT_PATH Function

The CURRENT_PATH function in H2 database is used to retrieve the current working directory path.

2. Syntax

The syntax for the CURRENT_PATH function in H2 database is as follows:

CURRENT_PATH()

Arguments

  • None

Return

  • The CURRENT_PATH function returns the current working directory path as a string.

3. Notes

  • The CURRENT_PATH function in H2 database does not require any arguments.
  • The returned path is the current working directory path of the H2 database server.
  • The path is returned as a string, representing the file system path.

4. Examples

Here are a few examples demonstrating the usage of the CURRENT_PATH function in H2 database:

Example 1 - Retrieving the current working directory path:

SELECT CURRENT_PATH() AS current_path;

Output:

current_path
-----------------
C:\path\to\current\directory

Example 2 - Using the current path in a query:

SELECT * FROM my_table WHERE file_path LIKE CONCAT(CURRENT_PATH(), '%');

Output:

id | file_path
---+------------------
1 | C:\path\to\file1.txt
2 | C:\path\to\file2.txt

There are no directly related functions to CURRENT_PATH in H2 database. However, you can use the path returned by CURRENT_PATH in conjunction with other functions to perform operations on files or directories.