Subject | Re: [firebird-support] Key violation on Primary/Unique key constraint INTEG_55/30 on table(s) |
---|---|
Author | Gaurav Sood |
Post date | 2006-03-13T06:54:33Z |
On 3/13/06, Helen Borrie <helebor@...> wrote:
AS
BEGIN
Insert into ContactDetails (PersonID)
values (:PersonID);
END ^
I believe that is the procedure that the Trigger calls.
./heLen
Analyst
B. Engineering, B. IT
A.N.U (2004)
M: +61 401 409 620
H: +61 3 9376 8580
"In life, always do right. This will gratify some people and astonish the
rest."
� Mark Twain
[Non-text portions of this message have been removed]
>ALTER PROCEDURE NEWPERSON (PERSONID SMALLINT)
> At 04:49 PM 13/03/2006, you wrote:
> >Hi All
> >
> >I have an appication that has a database of various People( Primary Key
> ID)
> >and Samplewords from speech (with the Transcript, Utterance_Number, and
> >UtteranceWord_Number as Primary Key).
> >
> >There are 4 types of people (Parent, Client, Guardian, Professional, and
> a
> >general ALL category). When I try to insert a new entry to the People
> Table
> >using the GUI (having selected one of the People types using the
> >radiobuttons), I get the Key constraint INTEG_30.
>
> A constraint is a set of rules that you define for a data structure
> when you create objects in your database. For example, PRIMARY KEY,
> FOREIGN KEY and UNIQUE and NOT NULL are all constraints.
>
> INTEG_30 is the name of some constraint. You can examine the system
> table named RDB$RELATION_CONSTRAINTS to find out which table and
> columns this constraint applies to.
>
> You will get an exception when something attempts to violate a constraint.
>
> >Sometimes the error does
> >not repeat itself and the 'Add new Person' form comes up showing the
> >selected option for Person type, however, other times the error comes up,
> >and no 'Person Type' is selected.
>
> The problem will become apparent when you look at the constraints
> involved. If (as your Subject suggests) you are getting a violation
> of a primary or unique key constraint then the possibilities are:
>
> 1. that you already have a row in the person table that has the same
> primary key
> or
> 2. that you have a UNIQUE constraint on some other column, e.g. a
> person's name (which is *not* a wise idea!!)
> or
> 3. a NULL is being passed to something that is constrained as unique
>
>
> >The INTEG_55 error occurs when I attempt to insert a second transcript
> into
> >the SampleWords table.
>
> INTEG_55 is the name of a different constraint.
>
>
> >There is a trigger for the addition of a new Person to the People Table
> as
> >folows:
> >
> >CREATE TRIGGER NEWPERSONTRIGGER FOR PEOPLE
> >ACTIVE AFTER INSERT POSITION 0
> >AS BEGIN
> > EXECUTE PROCEDURE NewPerson(NEW.ID);
> > END ^
>
> You don't tell us what the procedure NewPerson(NEW.ID) is
> doing....what table the procedure acts upon....but the person who
> wrote this has made a mistake if he thought this would generate a key
> value for a newly inserted record in PEOPLE. An AFTER INSERT trigger
> cannot assign any values to the NEW.* context variables.
>
> So, this is probably the source of the key violation errors. Show us
> the content of this trigger.
AS
BEGIN
Insert into ContactDetails (PersonID)
values (:PersonID);
END ^
I believe that is the procedure that the Trigger calls.
>I don't know what the errors are referring to exactly, but I guess theYes, and that type of thing is usually wrong.. :)
> >software may not be selecting the correct radio button option for Person,
> >and so creating an error with an ambiguous type that does not fit the
> table
> >definition.
>
> That sounds far too complicated.
./heLen
>--
>
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://firebird.sourceforge.net and click the Resources item
> on the main (top) menu. Try Knowledgebase and FAQ links !
>
> Also search the knowledgebases at http://www.ibphoenix.com
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
Analyst
B. Engineering, B. IT
A.N.U (2004)
M: +61 401 409 620
H: +61 3 9376 8580
"In life, always do right. This will gratify some people and astonish the
rest."
� Mark Twain
[Non-text portions of this message have been removed]