Procedures, subqueries and parameters
On this page
CALL … YIELD (procedures)
Invoke a built-in procedure; YIELD selects its output columns into the row
stream. See Schema and maintenance procedures for the full catalogue.
CALL db.labels() YIELD label RETURN label ORDER BY label;
CALL db.index.vector.queryNodes('embIdx', 5, [0.1, 0.2, 0.3])
YIELD node, score
RETURN node, score;
// a standalone CALL (no RETURN) streams the procedure's own columns:
CALL db.constraints();
CALL { … } (subqueries)
Run a subquery per input row. Useful for post-UNION composition and
side-effecting units.
MATCH (p:Person)
CALL {
WITH p
MATCH (p)-[:KNOWS]->(f)
RETURN count(f) AS friends
}
RETURN p.name, friends;
- A subquery that returns columns folds them into the outer row.
- A unit subquery (no
RETURN) runs purely for side effects and leaves the outer cardinality unchanged.
Parameters
Statements may use $name parameters, supplied by the driver (or the embedding
API). Parameters are values, never query fragments.
MATCH (p:Person {email: $email}) RETURN p; // $email bound by the driver
MATCH (p:Person) WHERE p.age > $minAge RETURN p.name;
Related articles
Indexes and constraints · Procedure directory · Transactions and concurrency