1

What is the line-continuation character for HANA SQL? Considering I have a super long statement and want it to span across multiple lines instead of it being a super long one in a line.

Thanks.

Kawamoto Takeshi
  • 596
  • 1
  • 3
  • 24

2 Answers2

1

For most SQL statements, you can implicitly continue on the next line. There is no "line-continuation character". Long strings can be continued on the next line by separating them in multiple strings concatenated with ||.

For example, this is perfectly valid HANA SQL:

SELECT
  "RefID",
  "FirstName",
  "LastName"
FROM
  "People"
WHERE
  "FirstName" = 'Hubert Blaine'
  AND
  "LastName" = 'Wolfeschlegelsteinhausenbergerdorffvoralternwaren' ||
               'gewissenhaftschaferswesenchafewarenwholgepflegeun' ||
               'dsorgfaltigkeitbeschutzenvonangereifenduchihrraub' ||
               'giriigfeindewelchevorralternzwolftausendjahresvor' ||
               'andieerscheinenbanderersteerdeemmeshedrraumschiff' ||
               'gebrauchlichtalsseinursprungvonkraftgestartseinla' ||
               'ngefahrthinzwischensternartigraumaufdersuchenachd' ||
               'iesternwelshegehabtbewohnbarplanetenkreisedrehens' ||
               'ichundwohinderneurassevanverstandigmenshlichkeitt' ||
               'konntevortpflanzenundsicherfreunanlebenslamdlichf' ||
               'reudeundruhemitnichteinfurchtvorangreifenvonander' ||
               'erintlligentgeschopfsvonhinzwischensternartigraum';

PS: That person actually exists. :)

djk
  • 943
  • 2
  • 9
  • 27
0

You can hit the return key and have a statement split in multiple line for your convenience.

Like in the image below:

enter image description here

Even in dynamic SQL you can split the string (with the || operator) you're going to feed in the EXEC() command.

enter image description here

mik
  • 356
  • 1
  • 9
  • 24