VARTYPE()

From Lianjapedia
Revision as of 12:50, 8 December 2009 by Helengeorge (Talk)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Purpose

Function to return a letter code that represents a data type


Syntax

VARTYPE(<exp>[,<expL>])


See Also

ERROR(), ERRNO(), MESSAGE(), TYPE(), ON ERROR


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'. VARTYPE() will also return a 'U' for an undefined variable if SET CLIPPER is ON. 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


Products

Recital, Recital Server