I have a problem with the following:
I have a sequence that comes with the value:
"ORA-00904: TESTE: identificador inválido"
I need to replace this test field to empty ( '') in my query .
But if my query contains other field with the name for example TESTETE and I replace for '', it staies wrong, replacing TESTE for and TESTETE forTE
I want to replace the TESTE for `` and the TESTETE let how it is.
my example query is :
SELECT TESTE, TESTETE, fld1 FROM TBL
My logic is as follows:
String oracleMsg = "ORA-00904: TESTE: identificador inválido";
String query = "SELECT TESTE, TESTETE, OUTRO FROM TBL";
String comp = "TESTE";
if (oracleMsg.contains(comp)){
query = query.replace(comp, "''");
}
System.out.println(query);
Result: SELECT '', ''TE, OUTRO FROM TBL Expected Result? SELECT '', TESTETE, OUTRO FROM TBL
Thank you a lot!!!