5.5.2 Using the PATH_NAME Function
The PATH_NAME
function can only be used in combination with
the ONE ROW PER VERTEX
or ONE ROW PER STEP
clause in a SQL
graph query and returns the name of the path that the iterator variables are currently
iterating over.
The function can be specified only in the COLUMNS
clause of
the graph query and the return type is CHAR
. For example, consider the
following query:
SELECT *
FROM GRAPH_TABLE ( g1
MATCH p1 = (x)->(y), p2 = (y) -> (z)
ONE ROW PER VERTEX (v)
COLUMNS (PATH_NAME() AS pathnames)
);
The preceding query returns P1
and P2
as the values of
PATH_NAME
.
PATH_NAME
returns NULL
when there is a
single path pattern without a path variable declaration.
See Example 5-24 for more information.
Parent topic: Using ONE ROW PER Clause in a SQL Graph Query