Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Stored Procedures, VB6 and ADO RecordsAffected
I have an Oracle Stored Procedure:
PROCEDURE LockInvoice(oReturn OUT VARCHAR2, inInvID IN NUMBER)
IS
BEGIN
oReturn := 0;
UPDATE APINVOICE.INVOICES SET STATUS = 1 WHERE INV_ID = inInvID AND STATUS = 0; EXCEPTION WHEN OTHERS THEN oReturn := SQLERRM;
With adoCmd
Set .ActiveConnection = cn
.CommandType = adCmdStoredProc
.CommandText = "APINVOICE.WESCO_AP_APP.LockInvoice"
.Parameters.Append .CreateParameter("oReturn", adVarChar, adParamOutput, 50)
.Parameters.Append .CreateParameter("inInvID", adNumeric, adParamInput, , InvID)
.Execute lngRecordsAffected, , adExecuteNoRecords
If .Parameters("oReturn").Value = 0 Then LockInvoice = CBool(lngRecordsAffected) End If
The lngRecordsAffected variable returns 1 even when no records are updated.
However, If I do the following:
With adoCmd
Set .ActiveConnection = cnEnd With
.CommandText="UPDATE APINVOICE.INVOICES SET STATUS = 1 WHERE INV_ID = 1 AND STATUS = 0"
.CommandType=adCmdText
.Execute lngRecordsAffected, , adExecuteNoRecords
LockInvoice = CBool(lngRecordsAffected
The lngRecordsAffected variable returns 0 when no records are updated.
I see the same results with either the MSDAORA or OraOLEDB providers.
Any Ideas as to why would be greatly appreciated.
-- Al ReidReceived on Tue Oct 07 2003 - 06:38:17 CDT