QUOTER function

Converts the specified data type to CHARACTER and encloses the results in quotes when necessary.

The QUOTER function is intended for use in QUERY-PREPARE where a character predicate must be created from a concatenated list of string variables to form a WHERE clause. In order to process variables, screen values, and input values so that they are suitable for a query WHERE clause, it is often necessary to enclose them in quotes. For example, European-format decimals and character variables must always be enclosed in quotes. You can use the Quoter function to meet that requirement.

Syntax

QUOTER ( expression [ , quote-char [ , null-string]] )
expression
An expression in the data type that you want to convert to character and enclose with quotes.
quote-char
Either a single or double quote, enclosed in the opposite: "'" or '"'. The default is double quote. Passing ? for this argument results in double quotes.
null-string
The string you want for an unknown value: the word NULL or "" for example. The default is an unquoted question mark, which is the Unknown value (?).

For example, the following code:

DEFINE VARIABLE mychar As CHARACTER NO-UNDO INITIAL "Lift Line Skiing".
...
qhandle:QUERY-PREPARE("FOR EACH Customer WHERE Customer.Name = " +
  QUOTER(mychar))

Would produce this prepare-string:

FOR EACH Customer WHERE Customer.Name = "Lift Line Skiing".

Notes