How to get the insert ID in SQL?
I want to INSERT a record in a database using JDBC in OBJECTSCRIPT. At the same time, I want to obtain the insert ID. Is there a way to achieve this using the SQL Outbound adapter?
My code is something like this now:
Property Adapter As EnsLib.SQL.OutboundAdapter;
set sql = " INSERT INTO Prenotazioni_CUP "_
" (ID, cf
" VALUES (SEQTAB.NextVal, ?) "
set status = ..Adapter.ExecuteUpdate(.rs, sql, pRequest.cfAssistito)
Product version: IRIS 2021.1
??? you seem to insert the ID already ???
set sql = " INSERT INTO Prenotazioni_CUP "_" (ID, cf)"_" VALUES (SEQTAB.NextVal, ?)
??? not clear what you are looking for ???
Yes in this case I can simply retrieve the ID SEQTAB.NextVal with another query. Thanks.
Thanks
Would be great, but I don t have access to the java.sql package in my environment. Thank you for the answer anyway.
Thanks