The problem is the if statement. If
:material
is a bind variable and you want to check if the value is
null
then you could use:
if :Material IS NULL then
However, your code will always first insert the row and the update it if the material has a value. If you want to do an actual upsert, see
Merge[
^]