Top
Enterprise Postgres 17 SP1 Application Development Guide

B.4.1 Obtaining Result from Arguments with Different Data Types

Oracle database

SELECT NVL( col1,
            col2)
  FROM t1;

Note: col1 is assumed to be VARCHAR(100) type, and col2 is assumed to be CHAR(100) type

Fujitsu Enterprise Postgres

SELECT NVL( col1,
            CAST(col2 AS VARCHAR(100)))
  FROM t1;

Note: col1 is assumed to be VARCHAR(100) type, and col2 is assumed to be CHAR(100) type


Feature differences
Oracle database

Value expressions with different data types can be specified. If the first argument is a string value, then VARCHAR2 is returned, and if it is a numeric, then a numeric type with greater range is returned.

Fujitsu Enterprise Postgres

Value expressions with different data types cannot be specified.

Conversion procedure

Since the data types that can be specified for the expressions in the two arguments are unknown, use the following steps to convert:

  1. Check the data types specified for each of the two expressions.

  2. Using the data type that is to be received as a result, explicitly convert the other argument with CAST.