First of all I'm a newbie using node-red. I'm trying to insert some data into oracle database using oracledb-mod. As you can see on prints I'm facing some errors to just to insert. I had success to select data.
I'm broke the code into small step to understand node-red structure, but I dont have success yet.
Following the docs, msg.payload is an array in oracledb-mod, but it doesn't work for me.
msg.payload: array containing the fields to be used inside the query, first element in the array corresponds with the first :fieldname parameter in the query etc.
Which suggests you change the msg.payload[x] in the values to :fieldname but that makes little sense.
Just be careful. Dynamic queries are susceptible to SQL Injection. You would be far better of trying to use parameters.
Did you try using what i suggested:
Looking at that screenshot suggests there is another place you may need to setup - did you enter anything in the "Field Mappings"?
At a guess (I have never used this node - as I do not use oracle), you tell the Field Mappings where the data is in your payload then use the field mappings like this...
INSERT INTO automacao.variaveis
(codigo, datger, valor)
VALUES (:codigo, :datger, :valor)
Thank you about your concern and clue by SQL Injection.
I dont know how "Field Mappings" works, but I try doing what you said. I'm not sure if it make sense.
My function returns an array.