Uwamp SQL ER_PARSE_ERROR when trying to send data from OPCUA to my local sql database

Hey Everyone!

I've been trying to send a value from an OPCUA Server to my local database in Uwamp.

In my 'Insert Query' node, I want to send the value to the database when the payload is not equal to 0.

I tried using the IF statement and here the CASE statement but both kept giving me this ER_PARSE_ERROR after the INSERT part of the query.

The Insert query works without the case/if statement and I'm not sure what changes i can make to make it work.


Here is the picture of my flow and the full debug window.

The if function

if (msg.payload[1].value.value ==1) {
msg.payload=msg.payload[0].value.value;
}
else {
    msg.payload=0;
}
return msg;

The Insert Query

SELECT CASE
    WHEN ?=0
        THEN (SELECT 1)
        ELSE (INSERT INTO 'statankdatasd' ('tankLevel') VALUES (?))
END

Your help is highly appreciated