I've built this query:
UPDATE opportunity o
SET updated = NOW(), updated_user_id = {{ user_id }},
status_id = {{ status_id }},
array_size = {{ array_size == "" ? "NULL" : array_size }}
WHERE id = {{ opp_id }};
If array_size is empty ("") in my app, I want it to update the value of array_size (decimal(5,1)) to NULL.
Here's an example of my query's .query property value (i.e. the generated SQL):
UPDATE opportunity o
SET updated = NOW(), updated_user_id = 19,
status_id = 587,
array_size = NULL
WHERE id = 12257;
This SQL runs just fine if I execute it manually against my db.
When Retool executes it I get this error:
invalid input syntax for type numeric: "NULL"
I've tried many different approaches to try and get around this and none of them have worked.
Can you help me solve this problem?
Thank you,
Rob