Board index » delphi » Table does not support this operation because it is not uniquely indexed

Table does not support this operation because it is not uniquely indexed

I am using Builder 5 with Oracle 8.1.7 and I am having difficulties getting
a DBGrid to display data that has been inserted directly into the grid
element.  I am using a SELECT TQuery to retrieve the data.

After inserting new data, the information from the new record disappears
from the grid, however the information has been added to the table when
viewed from other table viewers.

I thought perhaps the best way of getting the information to appear was to
use the Refresh() method on the TQuery, however when I try to do that I get
the error message "Table does not support this operation because it is not
uniquely indexed."  I get this message even though the table has a primary
key.

Any suggestions as to how I might get the data to appear after it has been
inserted?

Garrad

 

Re:Table does not support this operation because it is not uniquely indexed


This is a known problem with the BDE. You can do a few things depending on
how you are generating your keys. If they are being generated on the server
using triggers, you are SOL. If you generate key from application, then I
suggest that you store that key and use it to fetch the record back. If you
are using the sequence in Oracle then just fetch the Nextval with a query in
which case you have the key and can fetch that record. These are
workarounds.

If you plan on doing some serious work with Oracle, then I suggest that you
evaluate DOA http://www.allroundautomations.nl This product does not suffer
from the same problems and is very solid and offers a host of Oracle centric
features that will allow you to take full advantage of Oracle.

--
Good Luck
stim...@linkline.com  (remove _ to send nospam)

Quote
"Garrad Wayling" <gar...@gsaust.com.au> wrote in message

news:3acc19f5_1@dnews...
Quote
> I am using Builder 5 with Oracle 8.1.7 and I am having difficulties
getting
> a DBGrid to display data that has been inserted directly into the grid
> element.  I am using a SELECT TQuery to retrieve the data.

> After inserting new data, the information from the new record disappears
> from the grid, however the information has been added to the table when
> viewed from other table viewers.

> I thought perhaps the best way of getting the information to appear was to
> use the Refresh() method on the TQuery, however when I try to do that I
get
> the error message "Table does not support this operation because it is not
> uniquely indexed."  I get this message even though the table has a primary
> key.

> Any suggestions as to how I might get the data to appear after it has been
> inserted?

> Garrad

Re:Table does not support this operation because it is not uniquely indexed


Quote
Garrad Wayling wrote:

> After inserting new data, the information from the new record
> disappears from the grid, however the information has been added to
> the table when viewed from other table viewers.

I had exactly this problem.  I put on a proper unique primary key and
the problem went away.

KenF

Re:Table does not support this operation because it is not uniquely indexed


Thanks for your response.  I am generating the key value using a sequence in
a "before insert" trigger such as :

"SELECT seq_sale.nextval
 INTO :NEW.sale_int_reference
 FROM DUAL;"

I realise I can change this statement in the trigger so it stores the data
in a variable, but how does fetching this value then cause the added line to
appear in the DBGrid?

Quote
"Stimpy" <stim...@linkline.com> wrote in message news:3acc2281_1@dnews...
> This is a known problem with the BDE. You can do a few things depending on
> how you are generating your keys. If they are being generated on the
server
> using triggers, you are SOL. If you generate key from application, then I
> suggest that you store that key and use it to fetch the record back. If
you
> are using the sequence in Oracle then just fetch the Nextval with a query
in
> which case you have the key and can fetch that record. These are
> workarounds.

> If you plan on doing some serious work with Oracle, then I suggest that
you
> evaluate DOA http://www.allroundautomations.nl This product does not
suffer
> from the same problems and is very solid and offers a host of Oracle
centric
> features that will allow you to take full advantage of Oracle.

> --
> Good Luck
> stim...@linkline.com  (remove _ to send nospam)

> "Garrad Wayling" <gar...@gsaust.com.au> wrote in message
> news:3acc19f5_1@dnews...
> > I am using Builder 5 with Oracle 8.1.7 and I am having difficulties
> getting
> > a DBGrid to display data that has been inserted directly into the grid
> > element.  I am using a SELECT TQuery to retrieve the data.

> > After inserting new data, the information from the new record disappears
> > from the grid, however the information has been added to the table when
> > viewed from other table viewers.

> > I thought perhaps the best way of getting the information to appear was
to
> > use the Refresh() method on the TQuery, however when I try to do that I
> get
> > the error message "Table does not support this operation because it is
not
> > uniquely indexed."  I get this message even though the table has a
primary
> > key.

> > Any suggestions as to how I might get the data to appear after it has
been
> > inserted?

> > Garrad

Re:Table does not support this operation because it is not uniquely indexed


Hi,
Are you using a DBGrid with a TQuery, with UpdateLive==true ?

It's not a good idea, because to see your new record
you must re-open the TQuery with the SELECT sentence.

If you Open a TQuery and it gives you 20 records, remember,
you have UpdateLive=true, then you add 5 records, is posible
you can see some records, but your TQuery ALWAYS have
twenty (20) records !!

To see the new five (5) records, you must re-Open the TQuery.

Luis Anibal

Re:Table does not support this operation because it is not uniquely indexed


Quote
Garrad Wayling <gar...@gsaust.com.au> wrote in message

news:3acd0448_2@dnews...
Quote
> Thanks for your response.  I am generating the key value using a sequence
in
> a "before insert" trigger such as :

> "SELECT seq_sale.nextval
>  INTO :NEW.sale_int_reference
>  FROM DUAL;"

> I realise I can change this statement in the trigger so it stores the data
> in a variable, but how does fetching this value then cause the added line
to
> appear in the DBGrid?

> "Stimpy" <stim...@linkline.com> wrote in message news:3acc2281_1@dnews...
> > This is a known problem with the BDE. You can do a few things depending
on
> > how you are generating your keys. If they are being generated on the
> server
> > using triggers, you are SOL. If you generate key from application, then
I
> > suggest that you store that key and use it to fetch the record back. If
> you
> > are using the sequence in Oracle then just fetch the Nextval with a
query
> in
> > which case you have the key and can fetch that record. These are
> > workarounds.

> > If you plan on doing some serious work with Oracle, then I suggest that
> you
> > evaluate DOA http://www.allroundautomations.nl This product does not
> suffer
> > from the same problems and is very solid and offers a host of Oracle
> centric
> > features that will allow you to take full advantage of Oracle.

> > --
> > Good Luck
> > stim...@linkline.com  (remove _ to send nospam)

> > "Garrad Wayling" <gar...@gsaust.com.au> wrote in message
> > news:3acc19f5_1@dnews...
> > > I am using Builder 5 with Oracle 8.1.7 and I am having difficulties
> > getting
> > > a DBGrid to display data that has been inserted directly into the grid
> > > element.  I am using a SELECT TQuery to retrieve the data.

> > > After inserting new data, the information from the new record
disappears
> > > from the grid, however the information has been added to the table
when
> > > viewed from other table viewers.

> > > I thought perhaps the best way of getting the information to appear
was
> to
> > > use the Refresh() method on the TQuery, however when I try to do that
I
> > get
> > > the error message "Table does not support this operation because it is
> not
> > > uniquely indexed."  I get this message even though the table has a
> primary
> > > key.

> > > Any suggestions as to how I might get the data to appear after it has
> been
> > > inserted?

> > > Garrad

Other Threads