Caché SQL Reference
$MVOCONV
[Back] [Next]
   
Server:docs2
Instance:LATEST
User:UnknownUser
 
-
Go to:
Search:    

A MultiValue internal-to-external conversion function.
Synopsis
$MVOCONV(expression,code)
Arguments
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 internal format to external format.
Description
The $MVOCONV function is a MultiValue conversion function used to convert a string from internal (storage) format to external (output) format. The type of conversion is specified by a character code string that is specific to the type of data to be converted.
$MVOCONV is a Caché SQL extension and is intended for MultiValue data compatibility. It is functionally identical to the MultiValue OCONV function, as described in the Caché MVBasic Reference. Refer to OCONV for further information.
The following types of conversions are supported:
The $MVOCONV function converts from internal format to external format. The $MVICONV function converts from external format to internal format. You can use the $MVOCONVS function to convert the elements of a dynamic array from internal format to external format.
Example
The following example converts a MultiValue date from internal to external 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:
   NEW SQLCODE
   SET indate=15000
   &sql(SELECT 
      $MVOCONV(:indate,'D'),
      $MVOCONV(:indate,'D2'),
      $MVOCONV(:indate,'D/'),
      $MVOCONV(:indate,'D2-')
          INTO :a,:b,:c,:d)
   IF SQLCODE=0 {
    WRITE a," = ",$ZDATE((indate+46385),1,,4),!
    WRITE b," = ",$ZDATE((indate+46385),1,,4),!
    WRITE c," = ",$ZDATE((indate+46385),1,,4),!
    WRITE d," = ",$ZDATE((indate+46385),1,,4) }
   ELSE { WRITE "error:",SQLCODE }
 
See Also