Help Center/ Database and Application Migration UGO/ User Guide/ Syntax Conversion/ Conversion Error Codes/ Error Codes Generated During Conversion from Oracle to GaussDB/ U0100056: GaussDB does not support index generation using non-immutable functions such as TO_DATE or TO_CHAR
Updated on 2026-03-19 GMT+08:00

U0100056: GaussDB does not support index generation using non-immutable functions such as TO_DATE or TO_CHAR

Description

GaussDB does not support index generation using non-immutable functions such as TO_DATE or TO_CHAR.

Database Type and Version

  • Source database type and version: Oracle versions supported by UGO
  • Target database type and version: GaussDB versions supported by UGO

Syntax Example

create  index index_range_index on range_index(to_date(date1,'yyyy-mm-dd')) ;

Suggestion

No automatic solution is available. Encapsulate TO_DATE and TO_CHAR within a user-defined immutable function and reference the function in an index expression.

Modified SQL statements compatible with GaussDB:

CREATE OR REPLACE FUNCTION dsc_fn_to_date
     ( i_date      IN  timestamp 
     , i_date_fmt  IN  TEXT ) 
returns timestamp without time zone
IMMUTABLE
AS
$PG$
    SELECT TO_DATE(i_date, i_date_fmt)
$PG$
LANGUAGE SQL;
---index
create  index index_range_index on range_index(dsc_fn_to_date(date1,'yyyy-mm-dd'))  ;