Database Toolbox | ![]() ![]() |
Get primary key information for database table or schema
Syntax
k = primarykeys(dbmeta, 'cata', 'sch') k = primarykeys(dbmeta, 'cata', 'sch', 'tab')
Description
k = primarykeys(dbmeta, 'cata', 'sch')
returns the primary key information for all tables in the schema sch
, of the catalog cata
, for the database whose database metadata object is dbmeta
, where dbmeta
was created using dmd
.
k = primarykeys(dbmeta, 'cata', 'sch', 'tab')
returns the primary key information for 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
k = primarykeys(dbmeta,'orcl','SCOTT','DEPT') MATLAB returns
dbmeta
is the database metadata objectorcl
is the catalog cata
SCOTT
is the schema sch
DEPT
is the table tab
The results show the primary key information as described in the following table.
Column |
Description |
Value |
1 |
Catalog |
orcl |
2 |
Schema |
SCOTT |
3 |
Table |
DEPT |
4 |
Column name of primary key |
DEPTNO |
5 |
Sequence number within primary key |
1 |
6 |
Primary key name |
PK_DEPT |
See Also
crossreference
, dmd
, exportedkeys
, get
, importedkeys
![]() | ping | procedurecolumns | ![]() |