简体   繁体   中英

Chasing up “ORA-01084: invalid argument in OCI call”

I've got here enterprise project with .net 4.0 c#, IBatisNet and CSLA framework.

One of project jobs is failing with ORA-01084: invalid argument in OCI call when calling insert proc in a package. Error message returned is cryptic at best, the stored proc has 83 input parameters which aren't bound by name (thanks to IBatis).

What is curious: I've got a set of records let's say Order and OrderItems . Order has 28 order items. The job has to renew the order by creating another Order and copying all OrderItems records. New order items are referencing the old order items by ParentOrderItemId field, which is also a selection criteria for Orders due to be renewed.

When I run it first time the process blows on OrderItemId: 12345 with ORA-01084 error. But when I rerun it next time, it successfully process OrderItemId: 12345 . And then blows up on OrderItemId: 12444 . I then rerun and it processes OrderItemId: 12444 correctly and so on and so forth.

I've got logs of DbParameters passed in they are the same in both cases.

I've got oci client trace, but it's not useful either.

I've setup logging on a database layer, and so far it's giving me nothing.

Any ideas how to trace those type of errors?

I was receiving this same error message. In my case it was because I was passing an empty string to a CLOB column. Normally I would pass a large XML document but sometimes there was no document. Now, I check for empty string and write "empty".

I guess after all these years I need to provide an answer.

The issue lies deep in Oracle .Net drivers. We had Qty field defined as an INT. Due to internal architecture Qty could be negative or null. 95% of cases Qty was positive integer (as it should be), but sometimes due to adjustments and other factors it could be null or negative.

So in the end I traced it to the order of how you put your records into the database:

Qty 1 Qty 0 Qty null Qty -1

works correctly.

But in this case:

Qty null Qty 1 Qty -1

will blow with OCI invalid argument on "-1" value.

I created a ticket on Oracle, and send it down to our product team to fix. Since then I moved on, so not too sure if and when was it fixed.

For what it's worth, I just encountered this error. The issue was an incorrect OracleType in one of my parameters. The type was set at a NVarchar and the database column had been changed to a Clob .

Try to explicitly define your parameter OracleType.

OracleParameter(string name, OracleType oracleType)

A nullable column with the data type nchar(2) was the problem for me. It does not accept null, but requires some values to be passed in while inserting data.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM