# insufficient bindings?

**URL:** <https://forum.datomic.com/t/insufficient-bindings/418>\
**Category:** Peer API\
**Created:** [April 24, 2018, 1:48pm UTC](https://forum.datomic.com/t/insufficient-bindings/418 "2018-04-24T13:48:38Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![eric-vergnaud](https://avatars.discourse-cdn.com/v4/letter/e/aeb1de/32.png) [@eric-vergnaud](https://forum.datomic.com/u/eric-vergnaud)\
**Post date:** [April 24, 2018, 1:48pm UTC](https://forum.datomic.com/t/insufficient-bindings/418/1 "2018-04-24T13:48:38Z")

</div>

Hi,

I have this datalog query:  
String query = “[:find ?e :in $ :where [?e :name ?name][(\> ?v1 ?name)]]”

which I call from Java as follows:

List inputs = Arrays.asList(cnx.db(), “King”);

QueryRequest request = QueryRequest.create(query, inputs.toArray());

return Peer.query(request);

I get:

db.error/insufficient-binding [?v1] not bound in expression clause: [(\> ?v1 ?name)]

This is simply copied from the online doc:

[https://docs.datomic.com/on-prem/query.html](https://docs.datomic.com/on-prem/query.html)

The only difference is I replaced the hardcoded value by v1

What is the right way to achieve this simple query (without using toString()) ?

---

<div class="post-metadata">

**Author:** ![benfle](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.datomic.com/benfle/32/164_2.png) [@benfle](https://forum.datomic.com/u/benfle)\
**Post date:** [April 24, 2018, 2:04pm UTC](https://forum.datomic.com/t/insufficient-bindings/418/2 "2018-04-24T14:04:55Z")

</div>

If you’re trying to find all entities whose name comes before “King”, you need to declare your input argument, `?v1`, in the query. Like this:

`[:find ?e :in $ ?v1 :where [?e :name ?name][(> ?v1 ?name)]]`

---

<div class="post-metadata">

**Author:** ![eric-vergnaud](https://avatars.discourse-cdn.com/v4/letter/e/aeb1de/32.png) [@eric-vergnaud](https://forum.datomic.com/u/eric-vergnaud)\
**Post date:** [April 24, 2018, 2:07pm UTC](https://forum.datomic.com/t/insufficient-bindings/418/3 "2018-04-24T14:07:15Z")

</div>

Thanks,  
Interesting, why do I not need to do this for equal:  
[:find ?e :in $ :where [?e :name ?v1]]

---

<div class="post-metadata">

**Author:** ![benfle](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.datomic.com/benfle/32/164_2.png) [@benfle](https://forum.datomic.com/u/benfle)\
**Post date:** [April 24, 2018, 2:08pm UTC](https://forum.datomic.com/t/insufficient-bindings/418/4 "2018-04-24T14:08:47Z")

</div>

I think you do too. Don’t you also get a “Insufficient Binding” error on `?v1` in this case?

---

<div class="post-metadata">

**Author:** ![eric-vergnaud](https://avatars.discourse-cdn.com/v4/letter/e/aeb1de/32.png) [@eric-vergnaud](https://forum.datomic.com/u/eric-vergnaud)\
**Post date:** [April 24, 2018, 2:09pm UTC](https://forum.datomic.com/t/insufficient-bindings/418/5 "2018-04-24T14:09:11Z")

</div>

No, all my tests pass

---

<div class="post-metadata">

**Author:** ![benfle](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.datomic.com/benfle/32/164_2.png) [@benfle](https://forum.datomic.com/u/benfle)\
**Post date:** [April 24, 2018, 2:19pm UTC](https://forum.datomic.com/t/insufficient-bindings/418/6 "2018-04-24T14:19:56Z")

</div>

Then I would take a risk and guess that there is a bug in your tests 🙂

---

<div class="post-metadata">

**Author:** ![eric-vergnaud](https://avatars.discourse-cdn.com/v4/letter/e/aeb1de/32.png) [@eric-vergnaud](https://forum.datomic.com/u/eric-vergnaud)\
**Post date:** [April 24, 2018, 2:37pm UTC](https://forum.datomic.com/t/insufficient-bindings/418/7 "2018-04-24T14:37:45Z")

</div>

Thanks, the tests were correct, but there was indeed a bug in my query builder, which was hidden until I bumped into the above  
Adding args as inputs helps a lot 😉 thanks!
