Caché SQL Reference
[Home] [Back] [Next]
InterSystems: The power behind what matters   
Class Reference   

A MultiValue external-to-internal conversion function.
expression A string expression, which can be the name of a column, a string literal, or the result of another function, where the underlying data type can be represented as any character type (such as CHAR or VARCHAR2).
code A character code, specified as a quoted string, that specifies the type of conversion to perform. Conversion is from external format to internal format.
The $MVICONV function is a MultiValue conversion function used to convert a string from external (output) format to internal (storage) format. The type of conversion is specified by a character code string that is specific to the type of data to be converted.
$MVICONV is a Caché SQL extension and is intended for MultiValue data compatibility. It is functionally identical to the MultiValue ICONV function, as described in the Caché MVBasic Reference. Refer to ICONV for further information.
The $MVICONV function converts from external format to internal format. The $MVOCONV function converts from internal format to external format. You can use the $MVICONVS function to convert the elements of a dynamic array from external format to internal format.
The following example converts a MultiValue date from external to internal format using various code values. Note that MultiValue internal date 0 is December 31, 1967, which corresponds to the Caché internal ($HOROLOG) date of 46385:
   SET indate="12/31/2008"
   &sql(SELECT $MVICONV(:indate,'D') INTO :a)
    WRITE a," = ",$ZDATE((a+46385),1,,4) }
    ELSE { WRITE "error:",SQLCODE }
See Also