O'Reilly logo

Greenplum - Architecture and SQL by Leona Coffing, Tom Coffing

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 14 – Conversions and Formatting

“An invasion of Armies can be resisted, but not an idea whose time has come.”

- Victor Hugo

Postgres Conversion Functions

Function Name

Conversion Operation

to_number()

Character to numeric

to_date()

Character or timestamp to date

to_timestamp()

Character to timestamp

to_char()

Numeric, date or timestamp to character

The following shows the syntax for using these functions:

,to_number(<character-data>,'<template>')

,to_date(<character-data>,'<template>')

,to_timestamp(<character-data>,'<template>')

,to_char(<numeric-data>);

The Greenplum database provides some functions that assist in the conversion of data from one type to another.

Postgres Conversion Function Templates

HH, HH12

Hour of day ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required