cancel
Showing results for 
Search instead for 
Did you mean: 

Generate Unique Sequence

amit_saroha
New Contributor III

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?

4 REPLIES 4

bojanvelevski
Valued Contributor

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.

@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.

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

@bojanvelevski - is it possible for you to show some working examples? I couldn’t understand it.