Casts
The Mercury DataBlade module
uses casts in two ways:
- To convert temperatures between Celsius and Fahrenheit
- To enable users to enter numbers as integer and decimal data types directly into CTemp and FTemp columns without having to use an explicit cast in their SQL statements
The temperature data type is implemented to reduce the number of casts you need to define. If you defined casts from integer and decimal for both CTemp and FTemp, and casts between CTemp and FTemp, you would create a total of six casts. Instead, you add integer and decimal casts only to the temperature type; the CTemp and FTemp types inherit the casts. This approach reduces the number of casts you have to define from six to four.