Posted By

pablazo on 12/14/06


Tagged

mysql sql replace Oracle comillas sybase


Versions (?)

Doblar comillas simples (escapar para Oracle y Sybase)


 / Published in: Java
 

  1. public static String mySimpleQuote (String pCadena){
  2.  
  3. if (pCadena==null) {
  4. return "";
  5. }
  6. String sCadena = ""; // Cadena procesada
  7. int nCount = 0;
  8.  
  9. try {
  10. // Tokenizamos la cadena
  11. StringTokenizer tok = new StringTokenizer (pCadena, "'");
  12.  
  13. while (tok.hasMoreTokens()){
  14. sCadena = sCadena + tok.nextToken () + "''";
  15. }
  16.  
  17. sCadena = sCadena.substring(0, sCadena.length() - 2);
  18. return sCadena;
  19. }
  20. catch (Exception e){
  21. return "";
  22. }
  23. }

Report this snippet  

You need to login to post a comment.