Reputation: 115
I need to convert the incoming JSON Object to BLOB to insert it in the oracle DB? How can I do this? I have tried with the below code but it is throwing Invalid Column Type
%dw 2.0
import * from dw::core::Binaries
output application/octet-stream
var t = write(payload , "application/json")
---
toHex(t)
Upvotes: 0
Views: 695
Reputation: 1383
If I'm not wrong, you need a Java byte[] so then the JDBC driver converts it to BLOB. In that case you may need something like this:
output application/java
---
write(payload, "application/json") as Binary {class: "byte[]"}
toHex() returns a String
Ref: https://help.mulesoft.com/s/question/0D52T00005QNB8sSAH/how-to-convert-a-payload-to-byte-array
Upvotes: 1