Skip to main content

Hi,

I have multiple features, for each I need use an Oracle sequence to get the ID of the feature.

Then I need to write the feature to the database. The ID must be unique.

I have used a SQLExecutor to obtain the sequence next value. 

I am struggling when there are multiple features to write. FME is executing the SQLExecutor multiple times before getting single value for the ID. 

I need to process each feature at a time i.e. run through SQLExecutor, get the feature ID and write feature to database, then proceed to next feature.

 

Any suggestions ?

 

 

Hi @sunsilk11,

Use a Sampler transformer to extract the first feature, then send it to the SQLExecutor to get the last Oracle sequence number. Use a FeatureMerger to merge that value on all the other features, then use that value as the Count Start in a Counter to create subsequent sequence values for all the features.

I am attaching a workspace snippet to illustrate.


I suspect the Oracle sequence will get out of sync this way, as you perform sequence_name.NEXTVAL once (in the SQLExecutor), but write many records to the database, each with its own unique ID.

This could be handled directly in Oracle, by firing a trigger that gets sequence_name.NEXTVAL when a record is inserted into the table.


Reply