Continuation Lines

By default, a physical line end (carriage return at the command prompt or in an application program) terminates the statement on that line. Upon encountering the line end, the software processes the current statement. However, statements that are too long to fit on one physical line can be continued onto any number of physical lines.

The backslash (\ - Escape) is used to signal the software that the current statement is incomplete and continues on the next physical line. In this circumstance, the backslash is called the continuation character.

The software handles the backslash as a continuation character depending on whether it appears outside or inside a quoted string.

Outside Quotation Marks

When the software encounters a backslash outside a quoted character string, it ignores any remaining characters on the current line and looks to the next physical line for the remainder of the statement. Processing does not begin until the software reaches the next physical line end (unless another unquoted backslash is encountered, as shown in the following example:

list all Employees where LastName = 'Smith'\
                   sorted by FirstName

Inside Quotation Marks

A backslash within a quoted string usually signals special treatment for the subsequent character(s). However, when the software encounters a quoted backslash as the last character before a physical line end, it assumes that the statement continues on the next physical line as shown in the following example:

list all Customers where City = 'Los\
Angeles'

The SET ESCAPECHAR Command

The SET ESCAPECHAR command is available to control how the backslash (\ - Escape) is handled within quoted strings. Normally, the backslash is treated as an escape or continuation character when found inside quoted strings. By issuing a SET ESCAPECHAR OFF command, you cause the software to treat the backslash as text when it appears in quoted strings.