11. Report-Writer Expressions and Formats : Types of Data in Expressions : String Constants
 
Share this page                  
String Constants
Many reports have lines of text that appear in the body of the report. You can specify these string constants by enclosing them in single quotation marks (').
The syntax for specifying any character string in most Report-Writer statements is:
'string'
Within a .query statement, however, use the quotes appropriate to your query language. As a convention, this document uses single quotes ('), as required in SQL queries, to delimit string constants.
Using double quotes for string constants outside of SQL queries does not necessarily generate an error in Report-Writer. However, if you activate delimited identifiers with the .delimid statement, using double quotes for string constants produces unexpected or incorrect results, because Ingres interprets the double quotes as signifying a delimited identifier.
If you want to include a single quotation mark within the text of a single‑quoted string constant, enter it as two adjacent single quotes, together on a single line, so that Report-Writer does not assume it has found the end of a string. Ingres automatically interprets a backslash (\) within a single‑quoted string as a literal backslash, unless it precedes a wild card character (see page Pattern Matching with Wild Cards).
For information on dereferencing double quotes within double‑quoted strings, see the QUEL User Notes section below.
Examples of valid strings delimited by single quotes are:
'This is a string'
'This string has extra    blanks     '
'This string has one \ backslash in it'
'This string has a ''single-quoted'' string in it'
'This string has a "double-quoted" string in it'
QUEL User Notes
Within a .query statement, the following must be enclosed in double quotes ("):
String constants
Dates, specified as string constants
Numeric templates
You need to dereference a literal double quotation mark (") or backslash (\) within a string constant by preceding it with a backslash (\).
Examples of valid strings delimited by double quotes are:
"This is a string"
"This has extra   blanks"
"This has a \"quoted\" string in it"
"This has one \\ backslash in it"
The syntax for a valid absolute date and time format for use in a QUEL query is:
"mm/dd/yy hh:mm:ss"
An example of a valid numeric template for use in a QUEL query is:
"$zz,zzz,zzn.nn"