Difference between revisions of "VARTYPE()"
Yvonne.milne (Talk | contribs) m (1 revision) |
Helen.george (Talk | contribs) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
==Purpose== | ==Purpose== | ||
Function to return a letter code that represents a data type | Function to return a letter code that represents a data type | ||
− | |||
==Syntax== | ==Syntax== | ||
VARTYPE(<exp>[,<expL>]) | VARTYPE(<exp>[,<expL>]) | ||
− | |||
==See Also== | ==See Also== | ||
− | [[ERROR()]], [[ERRNO()]], [[MESSAGE()]], [[TYPE()]] | + | [[ERROR()]], [[ERRNO()]], [[MESSAGE()]], [[TYPE()]] |
− | + | ||
==Description== | ==Description== | ||
Line 15: | Line 12: | ||
− | {| class="wikitable" | + | {| class="wikitable" width="100%" |
!Data type||Return Value | !Data type||Return Value | ||
|- | |- | ||
Line 92: | Line 89: | ||
|} | |} | ||
− | + | If <exp> contains a syntax error, or an undeclared variable, then VARTYPE() returns 'U'. Unlike the TYPE() function, VARTYPE() does not require the expression for evaluation to be enclosed in quotes. | |
− | If <exp> contains a syntax error, or an undeclared variable, then VARTYPE() returns 'U' | + | |
The optional <expL> is used to determine whether VARTYPE() returns the data type for expressions which evaluate to null (.NULL.). If <expL> is True (.T.) the data type is returned for <exp>. If <expL> is False (.F.), then VARTYPE() returns "X". | The optional <expL> is used to determine whether VARTYPE() returns the data type for expressions which evaluate to null (.NULL.). If <expL> is True (.T.) the data type is returned for <exp>. If <expL> is False (.F.), then VARTYPE() returns "X". | ||
− | |||
==Example== | ==Example== | ||
Line 105: | Line 100: | ||
</code> | </code> | ||
− | |||
− | |||
− | |||
[[Category:Documentation]] | [[Category:Documentation]] | ||
[[Category:Functions]] | [[Category:Functions]] |
Latest revision as of 10:33, 4 February 2013
Contents
Purpose
Function to return a letter code that represents a data type
Syntax
VARTYPE(<exp>[,<expL>])
See Also
ERROR(), ERRNO(), MESSAGE(), TYPE()
Description
The VARTYPE() function returns a letter code which represents the data type of the expression in <exp>. The return value of the letter code is a character string from the table below.
Data type | Return Value |
---|---|
ARRAY (STATIC) | A |
ARRAY (DYNAMIC | O |
BIGINT | N |
BIT | L |
BYTE | N |
CHARACTER | C |
CURRENCY | Y |
DATE | D |
DATETIME | T |
DECIMAL | N |
DOUBLE | N |
FLOAT | N |
GENERAL | G |
INTEGER | N |
LOGICAL | L |
LONG VARCHAR | M |
LONG VARBINARY | G |
MEDIUMINT | N |
MEMO | M |
NULL | X |
NUMERIC | N |
OBJECT | O |
PACKED | N |
QUAD | N |
REAL | N |
SHORT | N |
SMALLINT | N |
Syntax error | U |
TEXT | M |
TIME | C |
TIMESTAMP | T |
TINYINT | N |
Undefined | U |
VAXDATE | C |
VARCHAR | C |
ZONED NUMERIC | C |
If <exp> contains a syntax error, or an undeclared variable, then VARTYPE() returns 'U'. Unlike the TYPE() function, VARTYPE() does not require the expression for evaluation to be enclosed in quotes.
The optional <expL> is used to determine whether VARTYPE() returns the data type for expressions which evaluate to null (.NULL.). If <expL> is True (.T.) the data type is returned for <exp>. If <expL> is False (.F.), then VARTYPE() returns "X".
Example
i = 10 ? vartype(i) N