Difference between revisions of "VARTYPE()"

From Recital Documentation Wiki
Jump to: navigation, search
(Products)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
=VARTYPE()=
 
 
 
==Class==
 
Expressions and Type Conversion
 
 
 
 
==Purpose==
 
==Purpose==
 
Function to return a letter code that represents a data type
 
Function to return a letter code that represents a data type
Line 114: Line 107:
  
 
==Products==
 
==Products==
Recital Database Server, Recital Mirage Server, Recital Terminal Developer
+
Recital, Recital Server
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Functions]]
 
[[Category:Functions]]

Latest revision as of 16:50, 8 December 2009

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