# \[IGN-5112\]Oracle and generated ids

**URL:** <https://forum.inductiveautomation.com/t/ign-5112-oracle-and-generated-ids/9238>\
**Category:** Ignition\
**Created:** [October 28, 2014, 1:51am UTC](https://forum.inductiveautomation.com/t/ign-5112-oracle-and-generated-ids/9238 "2014-10-28T01:51:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ssorrell](https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/32.png) [@ssorrell](https://forum.inductiveautomation.com/u/ssorrell)\
**Post date:** [October 28, 2014, 1:51am UTC](https://forum.inductiveautomation.com/t/ign-5112-oracle-and-generated-ids/9238/1 "2014-10-28T01:51:03Z")

</div>

The typical ignition method of getting the generated id by adding getKey=1 to the runPrepQuery call throws a java exception indicating that getInt() is not supported. I modified the driver config to add support for getKey, but it didn't silence the exception. From what I can tell, if I were writing the Java JDBC code myself, I could accomplish getting the id with the following code:

```auto
PreparedStatement prepareStatement = connection.prepareStatement("insert...",
        new String[] { "your_primary_key_column_name" });
 
prepareStatement.executeUpdate();
 
ResultSet generatedKeys = prepareStatement.getGeneratedKeys();
if (null != generatedKeys && generatedKeys.next()) {
     Long primaryKey = generatedKeys.getLong(1);
}
```

Of course, I can completely roll my own java code to accomplish this myself, or maybe write a stored procedure (though I personally loathe putting code into the database, but get it that oracle is using a trigger and a sequence to accomplish this otherwise). Does anyone have any experience with this issue?

---

<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:** [October 25, 2022, 6:28pm UTC](https://forum.inductiveautomation.com/t/ign-5112-oracle-and-generated-ids/9238/2 "2022-10-25T18:28:28Z")

</div>

The year is 2022, and I am having the same issue here 😉

---

<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:** [October 25, 2022, 6:59pm UTC](https://forum.inductiveautomation.com/t/ign-5112-oracle-and-generated-ids/9238/3 "2022-10-25T18:59:22Z")

</div>

We have a bug ticket for this internally, but we also haven't given it a lot of priority (clearly 😳) because relatively few of our customers use Oracle, and relatively few of _those_ customers need `getKey`.

If you'd like it to happen sooner, talking to your sales rep and adding an [ideas post](https://ideas.inductiveautomation.com) are generally the way to go.

---

<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:** [October 25, 2022, 7:08pm UTC](https://forum.inductiveautomation.com/t/ign-5112-oracle-and-generated-ids/9238/4 "2022-10-25T19:08:51Z")

</div>

Oh! I got it, well for me the most important thing is to have this info. Because we always think we are missing something.
