db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jørgen Løland <Jorgen.Lol...@Sun.COM>
Subject Re: query for Primary Key Columns
Date Tue, 22 May 2007 07:10:18 GMT
Hi Ollie,

I think you have to use a stored procedure to get the primary key. The 
call to this stored procedure would be:

call sysibm.sqlprimarykeys(<catalog>,<schema>,<table>,<options>);

Since there are no catalogs in Derby, the following stored procedure 
call would provide you with the pk information:

call sysibm.sqlprimarykeys(null,'<schemaname>','<tablename>','');

Alternatively, if you use JDBC to access the database, I would recommend 
  you to have a look at the getPrimaryKeys method in DatabaseMetadata.

P.S. Questions like these would normally go to the derby-user mailing list.

ollie2308 wrote:
> Hello, ... new to derby database and want to query the system tables to
> obtain the column names that make up each tables primary key.
> Can this be done via a query ?  Can find table name, constraint name,
> constraint type, but can not get the columns that make up the pk
> Thanks

View raw message