Retrieve id of record just inserted into a Java DB (Derby) database

mac2022-06-30  22

https://stackoverflow.com/questions/4894754/retrieve-id-of-record-just-inserted-into-a-java-db-derby-database

————————————————————————————————————————————————————————————————————————

You may be able to get what you're looking for using the IDENTITY_VAL_LOCAL function. (Derby Reference)

This function is supposed to return "the most recently assigned value of an identity column for a connection, where the assignment occurred as a result of a single row INSERT statement using a VALUES clause."

It's worth noting that this function will return DECIMAL(31,0), regardless of the actual data type of the corresponding identity column.

Also, this only works for single row inserts that contain a VALUES clause.

转载于:https://www.cnblogs.com/cuizhf/p/7444522.html

相关资源:JAVA上百实例源码以及开源项目
最新回复(0)