Showing results for 
Search instead for 
Did you mean: 

Stored procedure

Node Link

I have a simple doubt. 

Can't we write stored procedure in cypher itself and use it like other SQL databases? 

Is using Java is the only option we have?? 


Node Link

Yeah , Using java is the only option so far.

Here you will find a good instruction on how to do that easily


Hi @suvi 

This document is also helpful.
You can create your procedure by Cypher with APOC.

Graph Buddy

I'm seeing a version mismatch when I attempt this.

The most recent of the jar that contains apoc.custom.asProcedure is 

apoc- I'm running neo4j enterprise v4.4.6.

When I attempt to start neo4j (v4.4.6) with apoc- installed, I get the following complaint:


2022-06-11 18:32:25.708+0000 WARN  [neo4j/cf363efa] The apoc version ( and the Neo4j DBMS versions [4.4.6] are incompatible. 
See the compatibility matrix in to see the correct version

It appears to me that I need to revert the version of Neo4J that I'm running all the way back to v4.4.0 in order to use anything in apoc.custom.


I'm not ready to take that drastic step.

Hi @tms !

2 things:

1. You may like to use instead.

2. It's a incorrect warning that will be solved soon. If you are planning on use this custom procedures you may like to use APOC (Compatible with 4.4.6)

Oh, y’all wanted a twist, ey?

The only plugin I have for APOC- is "apoc-". This is the "core" plugin, and does not include any apoc.custom methods. So far as I know, there is no "apoc-".

I'm under the perhaps incorrect impression that the "full" jar for 4.2 that you reference in your documentation URL is incompatible with neo4j enterprise v4.4.6.

So far as I know, this apoc.custom behavior is not currently available for neo4j enterprise 4.4.6.

@tms ,

2 things.

1. There's a full version of here

2. Also there, you can find the fresh out the oven 

Oh, y’all wanted a twist, ey?

Hi @suvi 

I checked with the same version.

Neo4j Enterprise 4.4.6
APOC (Good for 4.4.6 now)

スクリーンショット 2022-06-14 5.42.51.png

And I created the procedure.

CALL apoc.custom.asProcedure(
  'UNWIND range(0, $power) AS power
   RETURN $input ^ power AS answer',
  [['answer', 'long']],
  [['input','long'],  ['power', 'long']]


CALL custom.powers(9, 3);

 The result is here.
It works!!
スクリーンショット 2022-06-14 5.52.50.png

Node Link

Thanks @koji for that. I think this will work.
And also thanks to @Henrique for that article.
But now I wonder When should we use the Java implementation over the apoc custom procedure. Coz I feel former one is bit longer process. But I am sure there should be some advantage with the longer process.
would love to know what it is.

Hi @suvi!

Consider APOC as wrapper of your eventual implementation. At the end, it's a Java implementation on his own. In your use case, if the logic you want to wrap can be transform into Cypher predicates, you will be fine with APOC.

Some other cases may require a complex logic. In those scenarios you may need an implementation of your own. Learning how to do so will do no harm 😏

Oh, y’all wanted a twist, ey?

Thanks @bennu_neo .