Skip to main content

$MVOCONV

A MultiValue internal-to-external conversion function.

Synopsis

$MVOCONV(expression,code)

Arguments

Argument Description
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:

  • Character conversions: character-to-code, code-to-character.

  • Numeric conversions: decimal-to-hex, hex-to-decimal, masked decimal conversion, range extraction.

  • String conversions: case conversion, Soundex conversion, string length conversion, uniform string length adjustment, delimited substring extraction, pattern match extraction, string extraction by length.

  • Time and Date conversions: time internal-to-display format, date internal-to-display format, date display-to-internal format, date element extraction, date day-of-week, day-of-year, and quarter calculation.

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

FeedbackOpens in a new tab