Subject Re: [IBO] Dead Locks?
Author Gordon Hamm
Inside My stored proc, I set a flag in the pins table. here is the stored
proc code..
But not much more than this..

CREATE PROCEDURE VALIDATE_PIN (
V_PIN VARCHAR(10))
RETURNS (
V_IS_PREPAID CHAR(1),
V_CUST_IS_ACTIVE CHAR(1),
V_PIN_IS_ACTIVE CHAR(1),
V_BALANCE NUMERIC(15,2),
V_RUNNING_CALL_COST NUMERIC(15,2),
V_CREDIT_LIMIT NUMERIC(15,2),
V_CC_ROUND SMALLINT,
V_HOP_ROUND SMALLINT,
V_BILLTONAME VARCHAR(40),
V_CC_RATE NUMERIC(15,4),
V_HOP_RATE NUMERIC(15,4),
V_BILL_MIN_XSECONDS SMALLINT,
V_LAST VARCHAR(20),
V_CC_ISACTIVE CHAR(1),
V_LD_ISACTIVE CHAR(1),
V_HOP_ISACTIVE CHAR(1),
V_PINLAST VARCHAR(20),
V_PINFIRST VARCHAR(20),
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),
V_PIN_IS_IN_USE CHAR(1))
AS
begin
V_RESULT_CODE=0;
SELECT P.CUSTID,P.pin_is_active,P.pin_last,P.pin_FIRST,
P.pin_is_in_use,P.hop_isactive,P.cc_isactive,P.ld_isactive,
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.cc_rate,C.cc_round,C.Ld_rate,C.Ld_round,
C.billtoname,C.bill_min_xseconds,C.last
FROM PINS P
JOIN Customer C
ON C.custid = P.custid
WHERE P.pin = :V_PIN
INTO :V_CUSTID,:V_PIN_IS_ACTIVE,:V_PINLAST,:V_PINFIRST,

:V_PIN_IS_IN_USE,:V_HOP_ISACTIVE,:V_CC_ISACTIVE,:V_LD_ISACTIVE,
: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_CC_RATE,:V_CC_ROUND,:V_LD_Rate,:V_LD_Round,
:V_BILLTONAME,:V_BILL_MIN_XSECONDS,:V_LAST;

if (V_CustID IS NOT NULL ) then
Begin

/* if (V_PIN_IS_IN_USE = 'Y') THEN
BEGIN
V_RESULT_CODE=-8;
SUSPEND;
EXIT;
END*/

if ((V_CUST_IS_ACTIVE = 'Y' and V_PIN_IS_ACTIVE = 'Y') AND
(V_HOP_ISACTIVE = 'Y' or V_CC_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
UPDATE PINS SET PIN_IS_IN_USE = 'Y' , CALL_COUNT = CALL_COUNT + 1 WHERE
PIN = :V_PIN;
End
ELSE
BEGIN
V_RESULT_CODE=-1; /* pin not found */
SUSPEND;
EXIT;
End

suspend;
end



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


----- Original Message -----
From: "Svein Erling Tysvær" <svein.erling.tysvaer@...>
To: <ibobjects@yahoogroups.com>
Sent: Friday, August 10, 2001 2:21 AM
Subject: Re: [IBO] Dead Locks?


> Gordon,
> I find it hard to see anything here that can cause a deadlock. You only
> read values, and don't seem to update or delete anything. Maybe someone on
> this list or ib-support could help you more if you showed us the relevant
> parts of the code for your stored procedure VALIDATE_PIN.
>
> Set
>
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>