# Query Returns Invalid Column Index

**URL:** <https://forum.inductiveautomation.com/t/query-returns-invalid-column-index/110422>\
**Category:** Ignition\
**Tags:** ignition81, database, vision\
**Created:** [September 6, 2025, 12:21am UTC](https://forum.inductiveautomation.com/t/query-returns-invalid-column-index/110422 "2025-09-06T00:21:35Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![carter.doud](https://avatars.discourse-cdn.com/v4/letter/c/ed8c4c/32.png) [@carter.doud](https://forum.inductiveautomation.com/u/carter.doud)\
**Post date:** [September 6, 2025, 12:21am UTC](https://forum.inductiveautomation.com/t/query-returns-invalid-column-index/110422/1 "2025-09-06T00:21:35Z")

</div>

I am setting up a couple of named queries to run a database. I have a table made, but when I try to execute the query below, I get an error saying invalid column index

![Screenshot 2025-09-05 171930](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/1/11f7d90a86db4c01fc281a8471549378364424ca.png)

This is the table I am trying to insert into

![Screenshot 2025-09-05 172046](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/e/de401c639f6704b7022d2b3084bcf2ba63537d9f.png)

I have tried just about everything to try and get this to work, but can’t seem to fix the issue. Any ideas? We use oracle.

---

<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 6, 2025, 12:27am UTC](https://forum.inductiveautomation.com/t/query-returns-invalid-column-index/110422/2 "2025-09-06T00:27:50Z")

</div>

Double quotes delimit column names, table names, and other **structural** names (identifiers). Strings and other **values** that need delimiting use single quotes. Per the SQL standard, which Oracle follows closely. Other brands default to other quotes for identifiers and may tolerate double quotes for values. Oracle will not.

Further, Oracle handles unquoted identifiers as if entirely upper case. Other brands have various other behaviors when identifiers are not quoted. The standard requires that quoted identifiers be treated as case-sensitive, and all brands do, that I know.

---

<div class="post-metadata">

**Author:** ![carter.doud](https://avatars.discourse-cdn.com/v4/letter/c/ed8c4c/32.png) [@carter.doud](https://forum.inductiveautomation.com/u/carter.doud)\
**Post date:** [September 6, 2025, 12:28am UTC](https://forum.inductiveautomation.com/t/query-returns-invalid-column-index/110422/3 "2025-09-06T00:28:26Z")

</div>

same issue with single quotes…

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [September 6, 2025, 12:30am UTC](https://forum.inductiveautomation.com/t/query-returns-invalid-column-index/110422/4 "2025-09-06T00:30:52Z")

</div>

Isn't the correct syntax as shown below?

```sql
INSERT INTO FPI_Dwell_history
    (Work_Order)
VALUES
    ('123')

```

Note the plural, VALUES, and the single quotes.

Tip: post formatted code - not pictures - so we don't have to type it all out again.

---

<div class="post-metadata">

**Author:** ![carter.doud](https://avatars.discourse-cdn.com/v4/letter/c/ed8c4c/32.png) [@carter.doud](https://forum.inductiveautomation.com/u/carter.doud)\
**Post date:** [September 6, 2025, 12:32am UTC](https://forum.inductiveautomation.com/t/query-returns-invalid-column-index/110422/5 "2025-09-06T00:32:27Z")

</div>

will do, that still didn’t work

---

<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 6, 2025, 12:34am UTC](https://forum.inductiveautomation.com/t/query-returns-invalid-column-index/110422/6 "2025-09-06T00:34:00Z")

</div>

Try matching case exactly.

---

<div class="post-metadata">

**Author:** ![carter.doud](https://avatars.discourse-cdn.com/v4/letter/c/ed8c4c/32.png) [@carter.doud](https://forum.inductiveautomation.com/u/carter.doud)\
**Post date:** [September 6, 2025, 12:35am UTC](https://forum.inductiveautomation.com/t/query-returns-invalid-column-index/110422/7 "2025-09-06T00:35:03Z")

</div>

didn’t work, that was one of the first things I tried

---

<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 6, 2025, 12:35am UTC](https://forum.inductiveautomation.com/t/query-returns-invalid-column-index/110422/8 "2025-09-06T00:35:45Z")

</div>

You may need a schema prefix on the table name. No way to tell with what is shown.

---

<div class="post-metadata">

**Author:** ![carter.doud](https://avatars.discourse-cdn.com/v4/letter/c/ed8c4c/32.png) [@carter.doud](https://forum.inductiveautomation.com/u/carter.doud)\
**Post date:** [September 6, 2025, 12:36am UTC](https://forum.inductiveautomation.com/t/query-returns-invalid-column-index/110422/9 "2025-09-06T00:36:16Z")

</div>

how would I tell what that prefix would be?

---

<div class="post-metadata">

**Author:** ![robertm](https://avatars.discourse-cdn.com/v4/letter/r/ea5d25/32.png) [@robertm](https://forum.inductiveautomation.com/u/robertm)\
**Post date:** [September 6, 2025, 12:36am UTC](https://forum.inductiveautomation.com/t/query-returns-invalid-column-index/110422/10 "2025-09-06T00:36:20Z")

</div>

Repost your Query instead of just saying you tried each time. You’d be surprised how often you overlook syntax mistakes.

---

<div class="post-metadata">

**Author:** ![carter.doud](https://avatars.discourse-cdn.com/v4/letter/c/ed8c4c/32.png) [@carter.doud](https://forum.inductiveautomation.com/u/carter.doud)\
**Post date:** [September 6, 2025, 12:37am UTC](https://forum.inductiveautomation.com/t/query-returns-invalid-column-index/110422/11 "2025-09-06T00:37:24Z")

</div>

Fair.

```sql
INSERT INTO FPI_DWELL_HISTORY
	(WORK_ORDER)
VALUES
	('123')

```

---

<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 6, 2025, 12:38am UTC](https://forum.inductiveautomation.com/t/query-returns-invalid-column-index/110422/12 "2025-09-06T00:38:55Z")

</div>

Try:

```python
SELECT * FROM INFORMATION_SCHEMA.TABLES
   WHERE TABLE_NAME='FPI_DWELL_HISTORY'

```

Look at the schema column returned.

---

<div class="post-metadata">

**Author:** ![carter.doud](https://avatars.discourse-cdn.com/v4/letter/c/ed8c4c/32.png) [@carter.doud](https://forum.inductiveautomation.com/u/carter.doud)\
**Post date:** [September 6, 2025, 12:45am UTC](https://forum.inductiveautomation.com/t/query-returns-invalid-column-index/110422/13 "2025-09-06T00:45:08Z")

</div>

OK, weird thing just happened. I had a bunch of commented out lines in the query I assumed didn’t do anything (my bad I guess). Deleted all of them and tried solution, that errored out with table or view does not exist. Then tried this

```sql
INSERT INTO FPI_DWELL_HISTORY
	(WORK_ORDER)
VALUES
	('123')

```

again, and it seemed to work. Any ideas why using the /\* commenting method would cause it not to work?

---

<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 6, 2025, 12:46am UTC](https://forum.inductiveautomation.com/t/query-returns-invalid-column-index/110422/14 "2025-09-06T00:46:53Z")

</div>

Ignition uses vanilla JDBC, and JDBC doesn't play well with comments (or other SQL scripting keywords). Especially in named queries.

For best results, feed JDBC single statements with no comments.

In the future, when posting queries for commentary here, post the entire thing.

---

<div class="post-metadata">

**Author:** ![carter.doud](https://avatars.discourse-cdn.com/v4/letter/c/ed8c4c/32.png) [@carter.doud](https://forum.inductiveautomation.com/u/carter.doud)\
**Post date:** [September 6, 2025, 12:51am UTC](https://forum.inductiveautomation.com/t/query-returns-invalid-column-index/110422/15 "2025-09-06T00:51:26Z")

</div>

damn, thank you guys for the help!
