jeudi 28 juillet 2016

DB2 translate function equivalent in H2 for unit testing

I am using in-memory H2 for unit testing where as prod env is running on DB2. I have a requirement to remove non-alphanumeric characters @. from a field. I used REPLACE(TRANSLATE(BE.PARTY2_FIELD,'@.',' '), ' ','') which is working in in unit testing using H2 but failing when running in actual env which uses DB2. I see the reason is TRANSLATE function syntax in H2 and DB2 are different.

H2 - TRANSLATE ( value , searchString , replacementString)

DB2 - TRANSLATE ( value , replacementString, searchString)

Is there any solution to it which can work in both H2 and DB2?

Aucun commentaire:

Enregistrer un commentaire