# Error when inserting null in auto-generated historian table (oracle 12.2c)

**URL:** <https://forum.inductiveautomation.com/t/error-when-inserting-null-in-auto-generated-historian-table-oracle-12-2c/24453>\
**Category:** Ignition\
**Created:** [April 29, 2019, 1:05am UTC](https://forum.inductiveautomation.com/t/error-when-inserting-null-in-auto-generated-historian-table-oracle-12-2c/24453 "2019-04-29T01:05:59Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![emovspunk1996](https://avatars.discourse-cdn.com/v4/letter/e/e0b2c6/32.png) [@emovspunk1996](https://forum.inductiveautomation.com/u/emovspunk1996)\
**Post date:** [April 29, 2019, 1:05am UTC](https://forum.inductiveautomation.com/t/error-when-inserting-null-in-auto-generated-historian-table-oracle-12-2c/24453/1 "2019-04-29T01:05:59Z")

</div>

Hello, I am using oracle 12.2c and I encounter this problem in my historian.I cant figure out how to fix this error because this is an auto-generated table please help  
thank you

```auto
java.sql.SQLIntegrityConstraintViolationException: ORA-01400: cannot insert NULL into ("TESTDB"."SQLTH_DRV"."id")

```

---

<div class="post-metadata">

**Author:** ![KathyApplebaum](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kathyapplebaum/32/7261_2.png) [@KathyApplebaum](https://forum.inductiveautomation.com/u/KathyApplebaum)\
**Post date:** [April 29, 2019, 2:54pm UTC](https://forum.inductiveautomation.com/t/error-when-inserting-null-in-auto-generated-historian-table-oracle-12-2c/24453/2 "2019-04-29T14:54:53Z")

</div>

The error is saying you are trying to insert null into a column that is either a primary key or has been explicitly marked as not null. In this case, ‘id’ is the primary key of the table.

---

<div class="post-metadata">

**Author:** ![emovspunk1996](https://avatars.discourse-cdn.com/v4/letter/e/e0b2c6/32.png) [@emovspunk1996](https://forum.inductiveautomation.com/u/emovspunk1996)\
**Post date:** [April 30, 2019, 2:34am UTC](https://forum.inductiveautomation.com/t/error-when-inserting-null-in-auto-generated-historian-table-oracle-12-2c/24453/3 "2019-04-30T02:34:15Z")

</div>

but the tables are auto-generated and these are historian tables and alarm events. Should I modify the tables? if I do so it gives me an error of Invalid conversion error. I updated my ojdbc driver to 8 since I am using oracle 12cr2

---

<div class="post-metadata">

**Author:** ![KathyApplebaum](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kathyapplebaum/32/7261_2.png) [@KathyApplebaum](https://forum.inductiveautomation.com/u/KathyApplebaum)\
**Post date:** [April 30, 2019, 1:12pm UTC](https://forum.inductiveautomation.com/t/error-when-inserting-null-in-auto-generated-historian-table-oracle-12-2c/24453/4 "2019-04-30T13:12:51Z")

</div>

I guess we need more information – are you trying to manually insert data (either outside of Ignition or through scripting in Ignition), or are you encountering this when Ignition is trying to store tag history? I assumed the former from your first question.

---

<div class="post-metadata">

**Author:** ![emovspunk1996](https://avatars.discourse-cdn.com/v4/letter/e/e0b2c6/32.png) [@emovspunk1996](https://forum.inductiveautomation.com/u/emovspunk1996)\
**Post date:** [May 1, 2019, 8:00am UTC](https://forum.inductiveautomation.com/t/error-when-inserting-null-in-auto-generated-historian-table-oracle-12-2c/24453/5 "2019-05-01T08:00:36Z")

</div>

I encountered this when ignition tries to store alarm events data and tags history to the database. ignition tries to insert null value to the id column which always gives an error of ORA-1400

---

<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:** [May 1, 2019, 1:15pm UTC](https://forum.inductiveautomation.com/t/error-when-inserting-null-in-auto-generated-historian-table-oracle-12-2c/24453/6 "2019-05-01T13:15:27Z")

</div>

That column should have default that retrieves the next sequence. Sounds like that didn’t get set up correctly.

---

<div class="post-metadata">

**Author:** ![gabriel2](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/gabriel2/32/27208_2.png) [@gabriel2](https://forum.inductiveautomation.com/u/gabriel2)\
**Post date:** [September 9, 2022, 2:06pm UTC](https://forum.inductiveautomation.com/t/error-when-inserting-null-in-auto-generated-historian-table-oracle-12-2c/24453/7 "2022-09-09T14:06:45Z")

</div>

Just to inform that I have the same problem here using Oracle 21c and Ignition 8.1.16

---

<div class="post-metadata">

**Author:** ![gabriel2](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/gabriel2/32/27208_2.png) [@gabriel2](https://forum.inductiveautomation.com/u/gabriel2)\
**Post date:** [September 9, 2022, 3:23pm UTC](https://forum.inductiveautomation.com/t/error-when-inserting-null-in-auto-generated-historian-table-oracle-12-2c/24453/8 "2022-09-09T15:23:57Z")

</div>

Solved here, the user I created did not had permission to create sequences, thus, the table wasn’t able to accept null for the column ID!

After giving the permission I suggest deleting all stuff (tables and sequences) you have and create the connection again so Ignition can rebuild the database correctly.
