Hi,

we have an application that should work with oracle and postgresql as a
database backend. Unfortunately, the syntax for getting values from a
sequence is slightly different for both databases and we therefore
cannot use the same sql for both.

Has somebody solved this problem already? Where would be the best place
to do the switch? Would you recommend to create two different statements
and do the switching in the java code, i. e. something like

<select id="getNextFromSequence-Postgresql">
...
</select>
<select id="getNextFromSequence-Oracle">
...
</select>


and in java

                if (sqlMapClient.getCurrentConnection() instanceof 
OracleConnection) {
                        
sqlMapClient.queryForObject("getNextFromSequence-Oracle");
                } else {
                        
sqlMapClient.queryForObject("getNextFromSequence-Postgresql");
                }

or is there a clever way to do that with dynamic sql?

Best regards

Bernd






Reply via email to