next up previous contents index
Next: Support Functions Up: Data Types Previous: Installed Types

  
Type Conversion Using CAST

 In most cases, values of one type are converted to another type automatically. In those rare circumstances where you need to explicitly convert one type to another, you can use CAST to perform the conversion. To convert val to an INTEGER , use CAST(val AS INTEGER). To convert a column date_col of type DATE  to type TEXT, use CAST(date_col AS TEXT). You can also perform type casting using double colons--that is, date_col::text or num_val::numeric(10,2). 


Bruce Momjian
2001-05-09