Search code examples
neo4jcypherlong-integer

large integers in cypher, neo4j


I have a dataset with some hexadecimal integers like '4726E440'. I want to add this numbers as attributes of the nodes. If I execute:

CREATE (n {id:toInt("4726E440")});

neo4j gives me this error:

integer, 4726E440, is too large

Is there any way to handle this kind of integers (other than saving them as strings)?


Solution

  • Not 100% sure, but this looks like you're trying to convert a string holding a floating point number 4724*10^440 to an int value. That one obviously is too large.

    If you want to use hex literals you need to prefix them with 0x, e.g.

    return toInt(0x4726E440)
    

    returns 1193731136 - so it's still in range.