Is there any way I can write (copy-paste) nicely-formatted SQL queries in Java string literals using Eclipse?

前端 未结 7 1496
情深已故
情深已故 2020-12-29 05:43

When I wish to use SQL queries in Java, I usually hold them in final String variables. Now, when the string is too large, it goes out of page breadth, and we either have to

7条回答
  •  [愿得一人]
    2020-12-29 05:46

    This is quite close: how to paste your SQL indented with leading whitespace: https://stackoverflow.com/a/121513/1665128

    String sql =
        "SELECT\n" + 
        "  *\n" + 
        " FROM\n" + 
        "  something\n" + 
        " WHERE\n" + 
        "  id=4;";
    

提交回复
热议问题