| Contents | Index |
i = importedkeys(dbmeta, 'cata', 'sch')
i = importedkeys(dbmeta, 'cata', 'sch',
'tab')
i = importedkeys(dbmeta, 'cata', 'sch') returns foreign imported key information, that is, information about fields that reference primary keys in other tables, in the schema sch, of the catalog cata, for the database whose database metadata object is dbmeta.
i = importedkeys(dbmeta, 'cata', 'sch', 'tab') returns foreign imported key information in the table tab. In turn, fields in tab reference primary keys in other tables in the schema sch, of the catalog cata, for the database whose database metadata object is dbmeta.
Get foreign key information for the schema SCOTT in the catalog orcl, for dbmeta.
i = importedkeys(dbmeta,'orcl','SCOTT')
i =
Columns 1 through 7
'orcl' 'SCOTT' 'DEPT' 'DEPTNO' 'orcl' ...
'SCOTT' 'EMP'
Columns 8 through 13
'DEPTNO' '1' 'null' '1' 'FK_DEPTNO'...
'PK_DEPT'
The results show foreign imported key information as described in the following table.
| Column | Description | Value |
|---|---|---|
1 | Catalog containing primary key, referenced by foreign imported key | orcl |
2 | Schema containing primary key, referenced by foreign imported key | SCOTT |
3 | Table containing primary key, referenced by foreign imported key | DEPT |
4 | Column name of primary key, referenced by foreign imported key | DEPTNO |
5 | Catalog that has foreign imported key | orcl |
6 | Schema that has foreign imported key | SCOTT |
7 | Table that has foreign imported 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 foreign key | 1 |
10 | Update rule, that is, what happens to the foreign key when the primary key updates | null |
11 | Delete rule, that is, what happens to the foreign key when the primary key is deleted | 1 |
12 | Foreign imported key name | FK_DEPTNO |
13 | Primary key name in referenced table | PK_DEPT |
In the schema SCOTT, there is only one foreign imported key. The table EMP contains a field, DEPTNO, that references the primary key in the DEPT table, the DEPTNO field.
EMP is the referencing table and DEPT is the referenced table.
DEPTNO is a foreign imported key in the EMP table. Reciprocally, the DEPTNO field in the table DEPT is an exported foreign key and the primary key.
For a description of the codes for update and delete rules, see the getImportedKeys property on the Sun Java Web site:
http://java.sun.com/j2se/1.4.2/docs/api/java/sql/
DatabaseMetaData.html
crossreference | dmd | exportedkeys | get | primarykeys

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |