From:       To:      
Home > Documentation > DB2 to PostgreSQL

Covert Built-in Functions from DB2 to PostgtreSQL

[DB2 to Postgres Converter]  [About Migration]  [Types Mapping]

IBM DB2 and PostgreSQL offer non-equal sets of built-in functions. To succeed with overall migration it is necessary to convert each DB2 function into PostgreSQL equivalent. The key differences between embedded functions of the two DBMS are listed below.

IBM DB2 PostgreSQL
DATE('2020-02-01') TO_DATE('01-02-2020','DD-MM-YYYY')
DAY(DATE('2020-02-01')) DATE_PART('day','2020-02-01'::date)
HOUR(NOW()) DATE_PART('hour',NOW())
MINUTE(NOW()) DATE_PART('minute',NOW())
MONTH(DATE('2020-02-01')) DATE_PART('month','2020-02-01'::date)
POSSTR(str1,str2) POSITION(str2 IN str1)
RAND() RANDOM()
SECOND(NOW()) DATE_PART('second',NOW())
YEAR(DATE('2020-02-01')) DATE_PART('year','2020-02-01'::date)