Subject Re: [IBO] Wrong record..
Author Gordon Hamm
> No, it shouldn't happen. We'd need to see the DDL involved to work out
why this happens to your app.
>
> Corrupt indexes don't work. Your application could, through some kind of
logic error, write a wrong value in a key, thus "corrupting" data integrity.
>
> More info please.

Thanks Helen,
Here is the code that is used in the stored proc..



CREATE PROCEDURE VALIDATE_ANI (
V_ANI VARCHAR(15))
RETURNS (
V_IS_PREPAID CHAR(1),
V_CUST_IS_ACTIVE CHAR(1),
V_ANI_IS_ACTIVE CHAR(1),
V_BALANCE NUMERIC(15,2),
V_RUNNING_CALL_COST NUMERIC(15,2),
V_CREDIT_LIMIT NUMERIC(15,2),
V_HOP_ROUND SMALLINT,
V_BILLTONAME VARCHAR(40),
V_CALL_COUNT INTEGER,
V_HOP_RATE NUMERIC(15,4),
V_BILL_MIN_XSECONDS SMALLINT,
V_DESCRIPTION VARCHAR(25),
V_LD_ISACTIVE CHAR(1),
V_HOP_ISACTIVE CHAR(1),
V_LD_RATE NUMERIC(15,4),
V_RESULT_CODE SMALLINT,
V_LD_ROUND SMALLINT,
V_CUSTID VARCHAR(20),
V_ASK_FOR_ACC_CODE CHAR(1),
V_ACC_CODE_SIZE SMALLINT,
V_VERIFY_ACC_CODE CHAR(1))
AS
begin
V_RESULT_CODE=0; /*success */
SELECT A.CUSTID,A.ANI_is_active,
A.hop_isactive,A.ld_isactive,A.description,
C.ask_for_acc_code,C.verify_acc_code,C.acc_code_size,

C.IS_PREPAID,C.BALANCE,C.running_call_cost,C.CREDIT_LIMIT,C.CUST_IS_ACTIVE,
C.hop_rate,C.hop_round,C.Ld_rate,C.Ld_round,
C.billtoname,C.bill_min_xseconds,C.CALL_COUNT
FROM ANIS A
JOIN Customer C ON C.custid = A.custid
WHERE A.ANI = :V_ANI
INTO :V_CUSTID,:V_ANI_IS_ACTIVE,
:V_HOP_ISACTIVE,:V_LD_ISACTIVE,:V_DESCRIPTION,
:V_ask_for_acc_code,:V_verify_acc_code,:V_acc_code_size,

:V_IS_PREPAID,:V_BALANCE,:V_RUNNING_CALL_COST,:V_CREDIT_LIMIT,:V_CUST_IS_ACT
IVE,
:V_HOP_RATE,:V_HOP_ROUND,:V_LD_Rate,:V_LD_Round,
:V_BILLTONAME,:V_BILL_MIN_XSECONDS,:V_CALL_COUNT;

if (V_CustID IS NOT NULL ) then
Begin
if ((V_CUST_IS_ACTIVE = 'Y' and V_ANI_IS_ACTIVE = 'Y') AND
(V_HOP_ISACTIVE = 'Y' or V_LD_ISACTIVE = 'Y')) then
begin
if (V_Balance + V_RUNNING_CALL_COST >= 0 and V_Is_Prepaid = 'Y')
then
begin
V_RESULT_CODE=-7;
SUSPEND;
EXIT;
end
END
ELSE
BEGIN
V_RESULT_CODE=-5; /* not active */
SUSPEND;
EXIT;
end

if (V_Balance > V_Credit_Limit) then
BEGIN
V_RESULT_CODE=-6;
SUSPEND;
EXIT;
end
/*if (V_DESCRIPTION IS NOT NULL) then
V_BILLTONAME=V_DESCRIPTION;*/
UPDATE ANIS SET CALL_COUNT = CALL_COUNT + 1 WHERE ANI = :V_ANI;
End
ELSE
BEGIN
V_RESULT_CODE=-2;
SUSPEND;
EXIT;
End
suspend;
end














Gordon Hamm
Voice Data Systems Inc.
435-635-7464

----- Original Message -----
From: "Helen Borrie" <helebor@...>
To: <IBObjects@yahoogroups.com>
Sent: Tuesday, August 14, 2001 9:35 AM
Subject: Re: [IBO] Wrong record..


> At 09:25 AM 14-08-01 -0600, you wrote:
> >Ive got a weird one. My app is working fine about 99% of the time.
Sometimes
> >however, the system does a query, and is returns a row from another
> >customer. This is very rare, but does happen. Could it be a corrupt index
of
> >some kind? Does this happen in IB? I am performing these queries in
Stored
> >Procs.
>
> No, it shouldn't happen. We'd need to see the DDL involved to work out
why this happens to your app.
>
> Corrupt indexes don't work. Your application could, through some kind of
logic error, write a wrong value in a key, thus "corrupting" data integrity.
>
> More info please.
>
> Regards,
> Helen
>
> All for Open and Open for All
> InterBase Developer Initiative ยท http://www.interbase2000.org
> _______________________________________________________
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>