Automatic Object Name Mapping

The target table name is taken from the TARGET clause of the MAP statement, and the target column names are taken from the source column names in the trail metadata.

Automatic Schema Evolution functionality currently supports object name mapping only when the target database CHARSET is either same as the source database CHARSET, or if its the superset of the source database CHARSET. In other cases, an appropriate error message is reported.

In cases where the table or column name length from source is too long (and this length is not supported on the target database), or the case where the table or column name contains unsupported characters (that are not supported on the target database), Replicat abends with an appropriate error message.

To continue, one of the following corrective actions must be taken:

The case sensitivity of the table or column names generated for Automatic Schema Evolution depends on the case sensitivity rules of the source and target databases and are governed by the following rules.

  1. In a case-sensitive source database to case-sensitive target database replication scenario, all the names are quoted and used.

  2. For any other combinations of source to target, including case-sensitive to case-insensitive, case- insensitive to case insensitive, and case-insensitive to case-sensitive, the following rules are followed:

    1. Table names are used exactly as specified in the TARGET clause of the MAP statement in the Replicat parameter file.

    2. Column names are used from the trail file, without any quotes, unless quoted explicitly in the COLMAP clause of the MAP statement in the Replicat parameter file.

If the column names contain any of the following special characters or spaces, the names will be quoted and used.

'".,{}()[]|+-_%~^#@/!><*&$:=?;\

Following are the object naming convention used by Automatic Schema Evolution for the following use cases:

  1. Use Case: Case Sensitive Source Database

    Options Behavior

    If you are replicating to a case-sensitive target database, consider the use case with:

    • The source table name as hr.employee

    • Column id type int (primary key)

    • Name type varchar

    If the target table name in the TARGET clause of the MAP statement contains a wildcard, then the same name and case as the source name is used for the target table with quotes added to it.

    Example:

    The MAP statement in the Replicat parameter file is the following

    MAP hr.*, TARGET region.*;

    Automatic Schema Evolution functionality generates the DDL on case-sensitive target database as:

    CREATE TABLE "region"."employee" ( "id" int not null, "name" VARCHAR(20), primary key ("id"));

    Note:

    The object name employee is quoted in the CREATE TABLE DDL because the source and target database are case sensitive.

    If you are replicating to a case-sensitive target database, consider the use case with:

    • The source table name as hr.employee

    • Column id type int (primary key)

    • Name type varchar

    If the target table name in the TARGET clause of the MAP statement contains an explicit name, then the same name and case as the source name is used for the target table with quotes added to it.

    Example:

    The MAP statement in the Replicat parameter file is as follows:

    MAP hr.employee, TARGET region.employee, COLMAP(USEDEFAULTS, "EMPNAME" = name); 

    Automatic Schema Evolution functionality generates the DDL on case-sensitive target database as follows:

    CREATE TABLE "region"."employee" ( "id" int not null, "EMPNAME" VARCHAR(20), primary key ("id"));

    Note:

    The object name employee is unquoted in the CREATE TABLE DDL as the object name in the TARGET clause of MAP statement is unquoted.

    If you are replicating to a case-insensitive target database, then consider use case with:

    • The source table name as hr.employee

    • Column id type int (primary key)

    • Name type varchar

    If the target table name in the TARGET clause of the MAP statement contains a wildcard, then the same name and case as the source name is used for the target table.

    Example:

    The map statement in the Replicat parameter file is the following:

    MAP hr.*, TARGET region.*;

    Automatic Schema Evolution functionality generates the DDL on case insensitive target database as follows:

    CREATE TABLE region.employee (id int not null, name VARCHAR(20), primary key (id));

    Note:

    The object name employee is unquoted in the CREATE TABLE DDL because the target clause has an unquoted wildcard name.

    If you are replicating to a case-insensitive target database, then consider use case with:

    • The source table name as hr.employee

    • Column id type int (primary key)

    • Name type varchar

    If the target table name in the TARGET clause of the MAP statement contains an explicit name, then the same name and case as the source name is used for the target table.

    Example:

    The MAP statement in the Replicat parameter file is the following:

    MAP hr.employee, TARGET region."employee", COLMAP(USEDEFAULTS, "EMPNAME" = name);

    Automatic Schema Evolution functionality generates the DDL on case-insensitive target database as follows:

    CREATE TABLE region."employee" ( id int not null, "EMPNAME" VARCHAR(20), primary key (id));

    Note:

    The object name employee is quoted in the CREATE TABLE DDL as the object name in the TARGET clause of MAP statement is quoted. EMPNAME is quoted in DDL, because it is specified as quoted in COLMAP clause
  2. Use Case: Case-Insensitive Source Database

    Options Behavior

    If you are replicating to a case-sensitive target database, then consider use case with:

    • The source table name as hr.employee

    • Column id type int (primary key)

    • Name type varchar

    If the target table name in the TARGET clause of the MAP statement contains a wildcard, then the same name and case as the source name is used for the target table.

    Example:

    The MAP statement in Replicat parameter file is the following:

    MAP hr.*, TARGET region.*;

    Automatic Schema Evolution functionality generates the DDL on case-sensitive target database as follows:

    CREATE TABLE region.employee ( id int not null, name VARCHAR(20), primary key (id));

    Note:

    The object name employee is unquoted in the CREATE TABLE DDL because the target clause has an unquoted wildcard name.

    If you are replicating to a case-sensitive target database, then consider use case with:

    • The source table name as hr.employee

    • Column id type int (primary key)

    • Name type varchar

    If the target table name in the TARGET clause of the MAP statement contains an explicit name, then the same name and case as the source name is used for the target table.

    Example:

    The MAP statement in the Replicat parameter file is the following:

    MAP hr.employee, TARGET region.employee, COLMAP(USEDEFAULTS, "EMPNAME" = name);

    Automatic Schema Evolution functionality generates the DDL on case-sensitive target database as follows:

    CREATE TABLE region.employee ( id int not null, "EMPNAME" VARCHAR(20), primary key (id));

    Note:

    The object name employee is unquoted in the CREATE TABLE DDL as the object name in the TARGET clause of MAP statement is unquoted.

    If you are replicating to a case-insensitive target database, then consider use case with:

    • The source table name as hr.employee

    • Column id type int (primary key)

    • Name type varchar

    If the target table name in the TARGET clause of the MAP statement contains a wildcard, then the same name and case as the source name is used for the target table.

    Example:

    The MAP statement in the Replicat parameter file is the following:

    MAP hr.*, TARGET region.*;

    Automatic Schema Evolution functionality generates the DDL on case-insensitive target database as follows:

    CREATE TABLE region.employee ( id int not null, name VARCHAR(20), primary key (id));

    Note:

    The object name employee is unquoted in the CREATE TABLE DDL because the target clause has an unquoted wildcard name.

    If you are replicating to a case-insensitive target database, then consider use case with:

    • The source table name as hr.employee

    • Column id type int (primary key)

    • Name type varchar

    If the target table name in the TARGET clause of the MAP statement contains an explicit name, then the same name and case as the source name is used for the target table.

    Example:

    The MAP statement in the Replicat parameter file is the following:

    MAP hr.employee, TARGET region.employee, COLMAP(USEDEFAULTS, EMPNAME = name);

    Automatic Schema Evolution functionality generates the DDL on case-insensitive target database as follows:

    CREATE TABLE region.employee ( id int not null, EMPNAME VARCHAR(20), primary key (id));

    Note:

    The object name employee is unquoted in the CREATE TABLE DDL as the object name in the TARGET clause of MAP statement is unquoted.