Board index » delphi » Oracle: create index and primary keys

Oracle: create index and primary keys

Dear madam,Sir,

We are experiencing a problem when creating indexes and primary keys
with an Oracle server while using BDE.

Questions:
- Why does the TTable.AddIndex method fail without raising a exception?
- When trying a statement like 'alter table t1 add primary key (field1)'
no exception is raised and on the server the primary key is not created.

How do we solve this problem ?

Best regards

Arnold Snippe.

--
=================================================
DG Groep                Tel: (31) 0172 213460
PO Box 222              Fax: (31) 0172 210165
2770 AE  Boskoop        
The Netherlands         Mailto:bak...@cistron.nl

 

Re:Oracle: create index and primary keys


Quote
DG Groep wrote in message <34DEDD5F.2...@cistron.nl>...
>Dear madam,Sir,

>We are experiencing a problem when creating indexes and primary keys
>with an Oracle server while using BDE.

>Questions:
>- Why does the TTable.AddIndex method fail without raising a exception?

This is odd.  I'm able to reproduce the problem.  Check the SQL Montior, it
appears that no DDL is actually sent to the server.

Quote
>- When trying a statement like 'alter table t1 add primary key (field1)'
>no exception is raised and on the server the primary key is not created.

If you put your DDL in a TQuery, Delphi will raise an exception on a
failure.  I've tested creating Primary Keys with TQueries without having any
problems.

Good Luck...

Matt Beckius
Certified Delphi Developer & Trainer
Next Training Class Feb 23-27
http://www.sourcetechcorp.com

Quote
>How do we solve this problem ?

>Best regards

>Arnold Snippe.

>--
>=================================================
>DG Groep Tel: (31) 0172 213460
>PO Box 222 Fax: (31) 0172 210165
>2770 AE  Boskoop
>The Netherlands         Mailto:bak...@cistron.nl

Re:Oracle: create index and primary keys


The problem with db servers is that all indexes must have a name and this
name must be unique. By default, a Paradox db doesn't give a name to the
primary index but since it applies on only one table, there is no problem
but when you try to create an index with no name on a server, an error will
be raised.
The way to work with db servers is to use sql statements in a TQuery to
create indexes from your app and you can be assured that it will work on all
servers (if you follow standard SQL syntax).

Other Threads