Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Can't update record - dup_val_on_index

Re: Can't update record - dup_val_on_index

From: Martin Haltmayer <Martin.Haltmayer_at_0800-einwahl.de>
Date: Sun, 20 Feb 2000 16:59:31 +0200
Message-ID: <38B00153.9C4F7FDA@0800-einwahl.de>


Please post the output of the following commands:



define table = customer

column index_name format a20
column column_name format a20
column uniqueness format a10
column column_position noprint

break on index_name skip

select

	distinct
	decode (i.owner, null, null, decode (i.owner, user, null, '"' || i.owner ||
'".')) || '"' || i.index_name || '"' as index_name,
	'"' || c.column_name || '"' as column_name,
	i.uniqueness,
	c.column_position

from all_tables t, all_indexes i, all_ind_columns c where 1 = 1
and t.table_name in ('&table', upper ('&table'))
and t.owner = user	-- from dual
and t.table_name = i.table_name
and t.owner = i.table_owner
and i.index_name = c.index_name
and i.owner = c.index_owner

--
order by index_name, column_position
;

Maybe some other user has a unique index on your customer name. The script should detect this.

Martin

Phoebe wrote:
>
> The customer table only have a primary key on ID.
> But when i drop the primary key, I can update the record successfully.
> However it will also insert one more same record into the table.
> Can anyone tell me how can i update the record without insert one more same
> record??
> Thanks in advance.
>
> Phoebe
>
> Paul Dorsey <pdorsey_at_dulcian.com> wrote in message
> news:LiRr4.15115$pN1.219098_at_news1.rdc1.nj.home.com...
> > Look at what indexes are on the table.
> > You probably have a unique index on name.
> >
> > --
> > Paul Dorsey
> > Dulcian, Inc.
> > (212) 595-7223
> > web address: http://www.dulcian.com
> > email: pdorsey_at_dulcian.com
> >
> >
> > Phoebe <phoebe_at_hkem.com> wrote in message
> > news:88oec7$nm8$1_at_news.ctinets.com...
> > > Dear all,
> > >
> > > I am writing application to update the record. I try to update the
> > > record when the "save" button pressed. But it throws an exception :
> > > dup_val_on_index
> > >
> > > cursor cur_cus is select * from customer
> > > where :id = id
> > > for update nowait;
> > > val_cus cur_cus%rowtype;
> > >
> > > if cur_cus%found then
> > > update customer set name = :name,
> > > address = :address
> > > where id = :id;
> > > commit;
> > >
> > > Can anyone tell me why dup_val_on_index raised when i update the record
> ??
> > > Thanks in advance.
> > >
> > > Phoebe
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >
Received on Sun Feb 20 2000 - 08:59:31 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US