06-02-2022 10:23 AM
Hi All,
I have a table in the Oracle database which has a unique key column. I have to insert data in this table and I am in need of generating a unique sequence while processing a file for each row. Could you suggest how to do it?
06-02-2022 10:34 AM
By unique sequence you mean integers? If the field is Autoincrement, pass only null , the DB engine will do the assignment of a primary key.
06-02-2022 10:36 AM
@bojanvelevski - Yes, integers. The database version is old, it can’t generate itself so it must be passed to it via snap logic by any method.
06-02-2022 10:54 AM
Well, it’s a bit tricky, but manageable. You can take the highest id (I’m presuming it’s an id field) with a select call to the database, and use that value to calculate the following ids, by including the snap.in.totalCount method.
To calculate the ID, use the following expression in a mapper:
$value_from_db + snap.in.totalCount
06-06-2022 09:41 AM
@bojanvelevski - is it possible for you to show some working examples? I couldn’t understand it.