Subject | Re: [firebird-support] Re: ISC ERROR CODE:335544665 PK-Constraint in stored procedure, not debug mode!?! |
---|---|
Author | ian |
Post date | 2007-01-09T11:28:30Z |
crizoo4712 wrote:
are not unique.
When p_counter = 0 and the new phone number is '0561-4711', how do you
know that '0561-47110' does not already exist?
regards
ian
>If the error refers to violating the pk, then the values being supplied
>
> Hello Helen, thanks for your help on my issue!
>
> The following insert-statement causes the pk-constraint:
>
> insert into subscriber_resource s2
> values (null, :p_resource_ ins, :p_carrier_import, :p_carrier_imp_ date,
> :p_carrier_export, :p_carrier_exp_ date, :p_cov_id, :p_date_activ
> e)
>
> The pk-constraint is on the column which is provided with the value
> of the parameter-field "p_resource_ ins" which contains a varchar(20)
> value, which contains phone-numbers. These have to be unique.
> and the parameter which I want to write into the table is provided
> like this before:
are not unique.
>How is p_counter initialised?
> p_resource_new = p_resource_root || cast(p_counter as varchar(2));
> p_counter = p_counter + 1;
> p_resource_ins = null;
> p_resource_ins = substr(p_resource_ new,1,20) ;
When p_counter = 0 and the new phone number is '0561-4711', how do you
know that '0561-47110' does not already exist?
>This appears to be a fundametaly flawed approach.
> As You can see, the uniqueness is provided by increasing a counter.
> The issue is just to extend phone numbers from (e.g.) '0561-4711' to
> '0561-47110' , '0561-47111' , ... '0561-47119' . Nothing else.
> I checked the stuff out by debugging and it worked, not in run mode.
> What's up here?
>
regards
ian