Subject Stored Procedure/Transaction Problem
Author Steve Harp
Hi Guys,



I'm using a stored procedure to insert/update records imported from a csv
file. Here's the procedure



/***************************************************************/

create procedure sp_AccountImport (

InvoiceID BigInt,

InvoiceDate TimeStamp,

SiteID Integer,

BillTO_Name VarChar(100),

BillTO_Address1 VarChar(100),

BillTO_Address2 VarChar(100),

BillTO_City VarChar(50),

BillTO_State Char(2),

BillTO_ZipCode VarChar(10),

LastPaymentDate TimeStamp,

LastPaymentAmt Numeric(12,2),

MonthlyBalFwd Numeric(12,2),

FinChgRate Numeric(12,2),

Description VarChar(100),

PONumber VarChar(25),

MonthActivity Numeric(12,2),

MonthDiscount Numeric(12,2),

Subtotal Numeric(12,2),

InvoiceTotal Numeric(12,2))

RETURNS (result integer)

AS

BEGIN

result = -1;



if (Exists(select InvoiceID

from
AccountImport

where
(InvoiceID = :InvoiceID))) then

Begin

update AccountImport

set InvoiceDate =
:InvoiceDate,


SiteID = :SiteID,


BillTO_Name = :BillTO_Name,


BillTO_Address1 = :BillTO_Address1,


BillTO_Address2 = :BillTO_Address2,


BillTO_City = :BillTO_City,


BillTO_State = :BillTO_State,


BillTO_ZipCode = :BillTO_ZipCode,


LastPaymentDate = :LastPaymentDate,


LastPaymentAmt = :LastPaymentAmt,


MonthlyBalFwd = :MonthlyBalFwd,


FinChgRate = :FinChgRate,


Description = :Description,


PONumber = :PONumber,


MonthActivity = :MonthActivity,


MonthDiscount = :MonthDiscount,


Subtotal = :Subtotal,


InvoiceTotal = :InvoiceTotal

where (InvoiceID =
:InvoiceID);

result = 0;

End

Else

Begin

insert into AccountImport


(InvoiceID, InvoiceDate, SiteID,


BillTO_Name, BillTO_Address1, BillTO_Address2,


BillTO_City, BillTO_State, BillTO_ZipCode,


LastPaymentDate, LastPaymentAmt, MonthlyBalFwd,


FinChgRate, Description, PONumber, MonthActivity,


MonthDiscount, Subtotal, InvoiceTotal)

values (:InvoiceID,
:InvoiceDate, :SiteID,


:BillTO_Name, :BillTO_Address1, :BillTO_Address2,


:BillTO_City, :BillTO_State, :BillTO_ZipCode,


:LastPaymentDate, :LastPaymentAmt, :MonthlyBalFwd,


:FinChgRate, :Description, :PONumber, :MonthActivity,


:MonthDiscount, :Subtotal, :InvoiceTotal);

result = 0;

End

END^

/***************************************************************/



When I run the process the first time (which would insert records)
everything is fine except that none of the Numeric fields are populated in
the database; they are all set to zero. If I run the same process a second
time (which would update the records) all the Numeric fields are properly
populated. I've verified that all the properties are populated correctly in
both cases. I'm using FirebirdSql.Data.FirebirdClient.dll v2.0.50727 of the
.NET provider. I'm inserting just over 57,000 records in a single
transaction.

1. Can anyone spot an error in my procedure code that would explain
the problem?

2. Is there a limit on the # of inserts within a transaction and have
I exceeded it?

3. Is this a possible bug in the .NET provider?



Thanks for any suggestions,

Steve





[Non-text portions of this message have been removed]