Note:
If you are sending queries between countries that use the comma for a decimal point, put a blank
after each comma separating values in a list of numeric values.
The selected argument is converted, if necessary, to the attributes of the result. The attributes of the result
are determined as follows:
v
If the arguments are dates, the result is a date. If the arguments are times, the result is a time. If the
arguments are timestamps, the result is a timestamp.
v
If the arguments are constants, the CCSID of the result is the CCSID that would result if the arguments
were concatenated.
v
If all arguments are fixed-length, the result is a fixed length of n, where n is the length of the longest
argument.
v
If any argument is variable length, the result is variable-length with length attribute n, where n is the
length attribute of the argument with the greatest length attribute.
v
If the arguments are numbers, the data type of the result is the data type that would result if the
arguments were added.
v
If all arguments are DBCS-only, the result is DBCS-only.
v
If the arguments are any combination of bracketed-DBCS, the result is DBCS-open.
v
If the arguments are DBCS-graphic, the result is DBCS-graphic.
If X is a DBCS-graphic field, Y fields and constants must all be DBCS-graphic. If X is not a DBCS-graphic
field, no Y fields or constants may be DBCS-graphic.
The CCSID of the result is as follows:
v
CCSID 65535 if any field or constant has CCSID 65535.
v
Mixed CCSID if any field has a mixed CCSID.
v
CCSID of a file field has precedence over result fields or constants.
v
CCSID of result fields has precedence over constants.
v
CCSID assigned to the result will be the CCSID of the first of the two values if both concatenated
values are fields from the file, or both are result fields.
v
CCSID 65535 is assigned to a DBCS-graphic constant if the job CCSID is a single-byte CCSID with no
associated DBCS CCSID.
VARCHAR Query for iSeries function
The VARCHAR function returns a varying-length character string representation of a string. VARCHAR
supports conversion from CHARACTER to VARCHAR and UCS-2 GRAPHIC to VARCHAR. Conversion of
numeric type data is not supported. VARCHAR supports conversion from CHARACTER to VARCHAR and
UCS-2 GRAPHIC to VARCHAR. Conversion of numeric type data is not supported.
The first argument must be a string expression; it must not be DBCS-graphic data.
The second argument, if specified as a
length
, is the length attribute of the resulting varying-length string.
The second argument must be an integer constant between 1 and 32740 if the first argument is not
nullable or between 1 and 32739 if the first argument is nullable. If the first argument is mixed data, the
second argument cannot be less than 4. If the second argument is not specified or DEFAULT is specified,
the result length is determined as follows, where n is the length attribute of the first argument.
v
If the first argument is SBCS or mixed data, the result length is n.
v
If the first argument is UCS2 graphic data and the result is SBCS data, the result length is n.
QQ VARCHAR (
expression
,
length
DEFAULT
,
ccsid
)
QR
Chapter 5. Defining result fields in Query for iSeries
63
|
|
|
|
Summary of Contents for @server iSeries
Page 1: ...iSeries Query for iSeries Use Version 5 SC41 5210 04 ERserver ...
Page 2: ......
Page 3: ...iSeries Query for iSeries Use Version 5 SC41 5210 04 ERserver ...
Page 12: ...x Query for iSeries Use V5R2 ...
Page 14: ...2 Query for iSeries Use V5R2 ...
Page 32: ...20 Query for iSeries Use V5R2 ...
Page 38: ...26 Query for iSeries Use V5R2 ...
Page 44: ...32 Query for iSeries Use V5R2 ...
Page 116: ...104 Query for iSeries Use V5R2 ...
Page 122: ...110 Query for iSeries Use V5R2 ...
Page 146: ...134 Query for iSeries Use V5R2 ...
Page 150: ...138 Query for iSeries Use V5R2 ...
Page 174: ...162 Query for iSeries Use V5R2 ...
Page 178: ...166 Query for iSeries Use V5R2 ...
Page 196: ...184 Query for iSeries Use V5R2 ...
Page 198: ...186 Query for iSeries Use V5R2 ...
Page 204: ...192 Query for iSeries Use V5R2 ...
Page 205: ...Part 4 Appendixes Copyright IBM Corp 2000 2002 193 ...
Page 206: ...194 Query for iSeries Use V5R2 ...
Page 210: ...198 Query for iSeries Use V5R2 ...
Page 242: ...230 Query for iSeries Use V5R2 ...
Page 256: ...244 Query for iSeries Use V5R2 ...
Page 270: ...258 Query for iSeries Use V5R2 ...
Page 272: ...260 Query for iSeries Use V5R2 ...
Page 292: ...280 Query for iSeries Use V5R2 ...
Page 293: ......
Page 294: ... Printed in U S A SC41 5210 04 ...