I have a very long string which includes many new lines ( it's a really long SQL statement ).
The SQL is easier to read when I break it up with newlines. But from time to time, I need to copy the sql statement from code to paste into sql developer.
In Perl, I always loved the qq operator, which you can use in place 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 find it awkward to have to break up the string in chunks like this:
String myString = " SELECT * " +
" FROM table_a a " +
" JOIN table_b b ON a.id = b.id ... etc ";
and it's hard to copy the SQL statement from code. I end up having to remove all the quotes and +'s
Is there a Java equivalent? Or is there a better trick to putting readable, copy-able SQL statements in Java code?