QUOTER ( expression , quote-char , null-string )An expression in the data type that you want to convert to character and enclose with quotes.
DEFINE VARIABLE mychar As CHARACTER NO-UNDO INITIAL "Lift Line Skiing"....qhandle:QUERY-PREPARE("FOR EACH Customer WHERE Customer.Name = " +QUOTER(mychar))
FOR EACH Customer WHERE Customer.Name = "Lift Line Skiing".
To address the situation where an Unknown value (?) in a list of concatenated strings could cause the entire string to be unknown and the QUERY-PREPARE to fail, the QUOTER function does not return the Unknown value (?) if the expression argument is unknown. Instead, it returns a known character value consisting of an UNQUOTED question-mark, by default, or the 3rd argument, if it is present.
DEFINE VARIABLE mychar As CHARACTER NO-UNDO....mychar = ?.qhandle:QUERY-PREPARE("FOR EACH Customer WHERE Customer.Name = " +QUOTER(mychar)).
FOR EACH Customer WHERE Customer.Name = ?.
For noncharacter data types, if expression is of type DECIMAL, INT64, INTEGER, DATE, DATETIME, DATETIME-TZ, and so on, the following occurs:
The expression is converted to character and enclosed in quotes. The conversion is similar to the EXPORT format. DATE types, however, always have the 4-digit year.
DEFINE VARIABLE mydec As DECIMAL NO-UNDO INITIAL 12.34....qhandle:QUERY-PREPARE("FOR EACH Customer WHERE Customer.Balance = " +QUOTER(mydec)).
FOR EACH Customer WHERE Customer.Balance = "12.34".
If expression is of data type CHARACTER, internal quotes are doubled. If the first and last byte are already quotes, then it is assumed that the quoting has already been done, and no further quotes are applied.
© 2013 Progress Software Corporation and/or its subsidiaries or affiliates. |