| Database Toolbox™ | ![]() |
f = crossreference(dbmeta, 'pcata',
'psch', 'ptab', 'fcata', 'fsch', 'ftab')
f = crossreference(dbmeta, 'pcata', 'psch', 'ptab', 'fcata', 'fsch', 'ftab') returns information about the relationship between foreign keys and primary keys for the database whose database metadata object is dbmeta. The primary key information is for:
The table ptab
In the primary schema psch
Of the primary catalog pcata
The foreign key information is for:
The foreign table ftab
In the foreign schema fsch
Of the foreign catalog fcata
Run crossreference to get primary and foreign key information given the following arguments:
The database metadata object.dbmeta
The primary and foreign catalog orcl
The primary and foreign schema SCOTT
The table DEPT that contains the referenced primary key
The table EMP that contains the foreign key
f = crossreference(dbmeta,'orcl','SCOTT','DEPT',...
'orcl','SCOTT','EMP')
f = 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 the following primary and foreign key information.
| Column | Description | Value |
|---|---|---|
1 | Catalog that contains primary key, referenced by foreign imported key | orcl |
2 | Schema that contains primary key, referenced by foreign imported key | SCOTT |
3 | Table that contains 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 key | orcl |
6 | Schema that has foreign key | SCOTT |
7 | Table that has foreign key | EMP |
8 | Foreign key 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 |
There is only one foreign key in the schema SCOTT. The table DEPT contains a primary key DEPTNO that is referenced by the field DEPTNO in the table EMP. The field DEPTNO in the table EMP table is a foreign key.
Tip
For a description of the codes for update and delete rules,
see the getCrossReference property on the Sun™ Java™ Web
site at http://java.sun.com/j2se/1.4.2/docs/api/java/sql/ |
dmd, exportedkeys, get, importedkeys, primarykeys
![]() | confds | cursor.fetch | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |