# Why is a parameter name in a named query giving me and index out of bound error?

**URL:** <https://forum.inductiveautomation.com/t/why-is-a-parameter-name-in-a-named-query-giving-me-and-index-out-of-bound-error/96515>\
**Category:** Ignition\
**Created:** [September 26, 2024, 8:24pm UTC](https://forum.inductiveautomation.com/t/why-is-a-parameter-name-in-a-named-query-giving-me-and-index-out-of-bound-error/96515 "2024-09-26T20:24:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cameron\_Hazelwood](https://avatars.discourse-cdn.com/v4/letter/c/7ba0ec/32.png) [@Cameron\_Hazelwood](https://forum.inductiveautomation.com/u/Cameron_Hazelwood)\
**Post date:** [September 26, 2024, 8:24pm UTC](https://forum.inductiveautomation.com/t/why-is-a-parameter-name-in-a-named-query-giving-me-and-index-out-of-bound-error/96515/1 "2024-09-26T20:24:38Z")

</div>

Hi there. I'm going through Inductive university and I'm following along with the videos and I have run into a strange error when working with named queries. I have 2 named queries that are using the same parameter name, which I named colName. The first named query used colName to filter the column on my table. My second named query is suppose to do a conditional filtered selection. However, in this second named query, when ever I go to execute the query I get an error stating "java.lang.ArrayIndexOutOfBoundsException". I have copied the code from the first query and pasted it into the second query and the same thing happens. The index out of bounds error goes away when I change the name of the parameter in the second query. Why would this fix it?  
I do not have any experience with SQL, so forgive me if I seem a bit ignorant.

Thank you.

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [September 26, 2024, 8:57pm UTC](https://forum.inductiveautomation.com/t/why-is-a-parameter-name-in-a-named-query-giving-me-and-index-out-of-bound-error/96515/2 "2024-09-26T20:57:54Z")

</div>

You’re going to have to show the named queries, and how you are calling them.

I highly suspect that the error is not coming from the queries, but rather from how they are being called.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 26, 2024, 9:01pm UTC](https://forum.inductiveautomation.com/t/why-is-a-parameter-name-in-a-named-query-giving-me-and-index-out-of-bound-error/96515/3 "2024-09-26T21:01:36Z")

</div>

Is your named query a script instead of a single statement? If so, and you have comments, you might screw up Ignition's attempt to be friendly.

(Don't use SQL scripts--they are not officially supported by vanilla JDBC.)

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [September 26, 2024, 9:20pm UTC](https://forum.inductiveautomation.com/t/why-is-a-parameter-name-in-a-named-query-giving-me-and-index-out-of-bound-error/96515/4 "2024-09-26T21:20:34Z")

</div>

Also, what version of Ignition are you using?

---

<div class="post-metadata">

**Author:** ![Cameron\_Hazelwood](https://avatars.discourse-cdn.com/v4/letter/c/7ba0ec/32.png) [@Cameron\_Hazelwood](https://forum.inductiveautomation.com/u/Cameron_Hazelwood)\
**Post date:** [September 27, 2024, 11:44am UTC](https://forum.inductiveautomation.com/t/why-is-a-parameter-name-in-a-named-query-giving-me-and-index-out-of-bound-error/96515/5 "2024-09-27T11:44:23Z")

</div>

I did have a comment on the named query that was not working. I tried taking the comment out and that did it! My named query was able to execute. I'll just have to keep notes on my queries in a different way than within the script itself. Thank you very much for your help!

---

<div class="post-metadata">

**Author:** ![Cameron\_Hazelwood](https://avatars.discourse-cdn.com/v4/letter/c/7ba0ec/32.png) [@Cameron\_Hazelwood](https://forum.inductiveautomation.com/u/Cameron_Hazelwood)\
**Post date:** [September 27, 2024, 11:46am UTC](https://forum.inductiveautomation.com/t/why-is-a-parameter-name-in-a-named-query-giving-me-and-index-out-of-bound-error/96515/6 "2024-09-27T11:46:32Z")

</div>

I am using Ignition 8.1. I am not calling my named queries from anywhere with in the project, I am using the testing tab within the named query editor. I appreciate your time for replying to my post!
