Create and Map User-defined Functions

Guides you through the steps required to create user-defined functions, and to map those functions using a text editor.

Create user-defined functions

  1. At a UNIX terminal, navigate to the FunctionEmulation.sql file, located in the $COBDIR/demo/sql/hcopg/functionemulation directory.

    This file contains a script that creates some user-defined math functions needed by the example code.

  2. Execute the following:
    >psql -h DBInstanceEndpoint –p=Port –u=UserId -d HCO_Test -a -f functionemulation.sql

Map user-defined functions

  1. At your UNIX terminal or File window, open the functionemulation.xml file in a text editor.
  2. Copy the contents of the functionemulation.xml file.
  3. Navigate to and open the DialectMappings.hcomap file, located in the $COBDIR/etc/hcopg folder.
  4. Insert the copied contents right before the end tag </NameMappingDataSet> in the DialectMappings.hcomap file and save.