Background documentationCREATE/DROP SCHEMAMAP Statement Locate this document in the navigation structure

 

A schema map is a mapping of the data from one schema to another. You can create a schema map using the CREATE SCHEMAMAP statement and delete a schema map using the DROP SCHEMAMAP statement.

Structure

Syntax Syntax

  1. <create_schema_map_statement> ::=
      CREATE SCHEMAMAP <schema_map_name> MAP SCHEMAMAP <schema_map_name>
    
    <drop_schema_map_statement> ::=
      DROP SCHEMAMAP <schema_map_name>
    
    <schema_map_name> ::=
      <identifier>
    
    <schema_to_schema> ::=
      <schema_name> TO <schema_name>
End of the code.

If you create a schema map with the CREATE SCHEMAMAP statement, the schema map name and the associated schema names are stored in system table MAPSCHEMANAMES. The associated schemas must already exist. If the name of the schema map or schema is identical to a keyword or if upper and lowercase notation is relevant, the name must be placed in double quotation marks. For each schema in a database, there is a DEFAULT schema map with the name ID that this schema maps onto itself.

The DROP SCHEMAMAP statement deletes the entries of the schema map specified in the statement from the MAPSCHEMANAMES table.

You can use any schema map with the USE SCHEMAMAP command or the IMPORT SCHEMA command.

Example

Example Example

CREATE SCHEMAMAP myschemamap MAP SCHEMA a1 TO b1, a2 TO b2

//

USE SCHEMAMAP myschemamap

//

IMPORT SCHEMA a1 ...

//

End of the example.

The data from schema a1 is mapped onto schema b1 and from schema a2 onto schema b2 (CREATE SCHEMAMAP). The schema map myschemamap (USE SCHEMAMAP) is valid for the entire Loader session, as long as you do not specify a new USE SCHEMAMAP command or specify another schema map in the IMPORT SCHEMA command. You enter the IMPORT SCHEMA command with the usual syntax; in other words, you specify the schema name of the exported data in the import command.

Example Example

IMPORT SCHEMA a1 ...

MAP SCHEMA a1 TO b1, a2 TO b2

CATALOG INSTREAM 'a1_csv.catalog'

End of the example.

The schema mapping a1 TO b1, a2 TO b2 is only valid for this IMPORT SCHEMA command. The schema map is created implicitly and then immediately deleted after the command is executed. A CREATE SCHEMAP statement is not necessary.

Example Example

IMPORT SCHEMA a1 ...

MAP SCHEMA myschemamap

CATALOG INSTREAM 'a1_csv.catalog'

End of the example.

The schema mapping is only valid for this IMPORT SCHEMA command. A schema map (myschemamap) predefined by CREATE SCHEMAMAP is used here.