Error in API POST when inserting object

Asked

Viewed 64 times

2

Hello,

I am trying to add an object to the database by calling my API and I get this error:

ORA-00932: inconsistent datatypes: expected NUMBER got NCLOB

I just wanted some help with directing, comments from where I can get more attention, any little thing, I’m accepting achism, because I really need to sort this out... I’ve been almost two days without knowing what to do... I don’t know where to look...

I’ve checked the data types of the object and the database, they’re the same...

Controller

[HttpPost, Route("api/User/Atualizar/")]
public void Atualizar([FromBody] MeuObjeto model)
{
    var Repositorio = new Repositorio();
    Repositorio.Adicionar(model); // Erro ocorre aqui
}

Editing

For didactic purposes here, I made it as simple as possible by connecting directly to API, so I edited the post to facilitate the visualization... Works the same way and generates the same error...

1 answer

2


This error is not in the API itself (let’s say), it happened in Oracle because you tried to run an operation between two different data types, but the data types are not compatible. Fix the operation so that the data types are compatible. You may want to use a conversion function like: TO_NUMBER.

For a complete list of Oracle functions.

  • I would have to do it by C#, above I used the Convert.ToInt64 to make the conversion of string for long, which in other Inserts works, however in this, as I need to go through the previous call to the controller, I received this error...

  • Well, can you debug the type of data that’s coming up in the endpoint update? Maybe you have to force some more casting at some of these points, and where you update with the table, I imagine that there is an SQL that receives the variable with the values received in the API, TO_NUMBER there would not solve?

  • Then, in debug, I get the correct data, long and string... I don’t have access to that part of the system, I couldn’t modify this that you suggested... I only have access to API...

  • 1

    I asked for help from the staff here, they took a look at some dependencies and it worked... I was really conflicting a class with what was in the bank... I thank you

Browser other questions tagged

You are not signed in. Login or sign up in order to post.