I have a very long line that includes many new lines (this is a really long SQL statement).
SQL is easier to read when I break it into new lines. But from time to time I need to copy the sql statement from the code to be inserted into the sql developer.
In Perl, I always liked the qq operator, which you can use instead of double quotes:
You use it something like this:
$myString = qq{ SELECT * FROM table_a a JOIN table_b b ON a.id = b.id ... etc };
Is there an equivalent in JAVA? I am uncomfortable breaking a line in chunks as follows:
String myString = " SELECT * " + " FROM table_a a " + " JOIN table_b b ON a.id = b.id ... etc ";
and it's hard to copy an SQL statement from code. In the end, I need to remove all quotation marks and +
Is there a Java equivalent? Or is there a better trick for placing readable, copyable SQL statements in Java code?
java operators string syntax perl
jeph perro
source share