Re: convert functions??
Posted in 1997
Informix does not have explicit type conversion. All conversions are implicit and are performed when needed to manage the operator or function. All datatypes may be converted from one type to another except BLOBs which are TEXT (like Sybase) and BYTE (IMAGE in Sybase). Informix like Oracle differentiates the (numeric) addition from string concatenation by two separate operators (+ and ||) so there is no ambiguity. Informix also uses the addition and substract operators (+ and -) to compute DATE values and INTEGER intervals, or DATETIME x TO y values and INTERVAL x TO y intervals. Informix also has the TRUNC() and ROUND() functions to change the precision of a numeric value, and the EXTEND() function to change that of a DATETIME or INTERVAL . The default precision is 0 decimals for numeric values, and YEAR TO DAY for DATETIME and INTERVAL values. But shame, the lack of an exlicit convert operators give some situations where the implicit conversions do not work the way desired (for example when converting a string containing a date/time value to a valid DATETIME x TO y value). The problem lays in the expected formats that such implicit Informix conversions expect. Sometime, you'll need to write yourself your own conversion function using a stored procedure. Al Dev a 'crit dans le message <34316D71.49EE@bmc.com>... >Is there a convert functions in informix? For example >as in sybase > > select convert(int, columnA) from table aa > >where columnA is char(30). > >The informix reference guides (sql) does not say anything about >converting the data types.