For built-in casts and user-defined implicit casts, the database server automatically (implicitly) invokes the cast to handle the data conversion. For example, you can compare a value of type INT with SMALLINT, FLOAT, or CHAR values without explicitly casting the expression because the database server provides system-defined casts to transparently handle conversions between these built-in data types.
When you define an explicit user-defined cast to handle conversions between two data types, you must explicitly invoke the cast with either the CAST...AS keywords or the double-colon cast operator (::). The following partial examples show the two ways that you can invoke an explicit cast:
... WHERE new_col = CAST(old_col AS newtype) ... WHERE new_col = old_col::newtypeHome | [ Top of Page | Previous Page | Next Page | Contents | Index ]