create_foreign_constraint 

Creates a foreign key constraint on a global or central table.

A foreign constraint can be defined on one or more columns; and multiple foreign key constraints can be defined on a table, but each foreign key constraint must cover a different combination of columns. 

Available in a network database and requires the star$define role.

Parameters:

 

Name Optional Type Description
table$  Mandatory Text The table to create the foreign key constraint on.
columns$ Mandatory Text List of columns in the foreign key constraint.
reference$ Mandatory Text The table with a primary key to be referenced.

Examples:

SELECT create_foreign_constraint('mytable','cola','pktable');  Creates a foreign constraint on column 'cola' that references the primary key on table 'pktable'.

Tips:

  • The columns parameter is a comma separated list of column names included in the constraint.
  • The star$constraints view indicates which constraints already exist.
Have more questions? Submit a request

Comments

Article is closed for comments.

Powered by Zendesk