How to do a DISTINCT call with database replication

0
I want to do a SELECT DISTINCT on an external Oracle database using the database replication module. Where the distinct is needed because of joining of certain tables. Is this possible and if yes: how?
asked
3 answers
3

Using a Distinct statement is something that has been added as a function in the Java code, however this is one of the settings that I've never added as a checkbox in the table mapping.
This is one of the many options that are available but were never added as an option in the UI.

In the Java on the ReplicationSettings class there is a function selectDistinct( boolean distinct ); By default this option is set to false to improve the speed of the query.

You could go into the java action: ImportByMapping, on line 149 the replicationSettings are being initialized, so if you would add : settings.selectDistinct( true ); on line 150 you would setup the queries to use a distinct. But keep in mind by just adding that statement all queries will then start using a distinct statement.

answered
0

If you set up the 'distinct' column as the key for the table mapping, you can set the import action to 'Synchronise and create if not found', then each value in the 'distinct' column should only create or update a single record

answered
0

Create a view in the oracle database with the DISTINCT clause and use that as table source in the replicator.

answered