Examples of Cast Expressions

The following examples show two different ways to convert the sum of x and y to a user-defined data type, user_type. The two methods produce identical results. Both require the existence of an explicit or implicit cast from the type returned by (x + y) to the user-defined type:
CAST ((x + y) AS user_type)
(x + y)::user_type
The following examples show two different ways of finding the integer equivalent of the expression expr. Both require the existence of an implicit or explicit cast from the data type of expr to the INTEGER data type:
CAST (expr AS INTEGER)
expr::INTEGER
In the following example, the user casts a BYTE column to the BLOB type and copies the BLOB data to an operating-system file:
SELECT LOTOFILE(mybytecol::blob, 'fname', 'client')
   FROM mytab 
   WHERE pkey = 12345;
In the following example, the user casts a TEXT column to a CLOB value and then updates a CLOB column in the same table to have the CLOB value derived from the TEXT column:
UPDATE newtab SET myclobcol = mytextcol::clob;