Database Toolbox Previous page   Next Page
exportedkeys

Get information about exported foreign keys

Syntax

Description

e = exportedkeys(dbmeta, 'cata', 'sch') returns the foreign exported key information (that is, information about primary keys that are referenced by other tables), in the schema sch, of the catalog cata, for the database whose database metadata object is dbmeta, where dbmeta was created using dmd.

e = exportedkeys(dbmeta, 'cata', 'sch', 'tab') returns the exported foreign key information (that is, information about the primary key which is referenced by other tables), in the table tab, in the schema sch, of the catalog cata, for the database whose database metadata object is dbmeta, where dbmeta was created using dmd.

Examples

Type

MATLAB returns

In this example:

The results show the foreign exported key information.

Column
Description
Value
1
Catalog containing primary key that is exported
null
2
Schema containing primary key that is exported
SCOTT
3
Table containing primary key that is exported
DEPT
4
Column name of primary key that is exported
DEPTNO
5
Catalog that has foreign key
null
6
Schema that has foreign key
SCOTT
7
Table that has foreign key
EMP
8
Foreign key column name, that is the column name that references the primary key in another table
DEPTNO
9
Sequence number within the foreign key
1
10
Update rule, that is, what happens to the foreign key when the primary key is updated
null
11
Delete rule, that is, what happens to the foreign key when the primary key is deleted
1
12
Foreign key name
FK_DEPTNO
13
Primary key name that is referenced by foreign key
PK_DEPT

In the schema SCOTT, there is only one primary key that is exported to (referenced by) another table. The table DEPT contains a field DEPTNO, its primary key, that is referenced by the field DEPTNO in the table EMP. The referenced table is DEPT and the referencing table is EMP. In the DEPT table, DEPTNO is an exported key. Reciprocally, the DEPTNO field in the table EMP is an imported key.

For a description of the codes for update and delete rules, see
http://java.sun.com/j2se/1.4.2/docs/api/java/sql/DatabaseMetaData.html for the getExporetedKeys property.

See Also
crossreference, dmd, get, importedkeys, primarykeys


Previous page  exec fetch Next page

© 1994-2005 The MathWorks, Inc.