As Barmar mentioned: '15b' cannot be converted to an integer. The SELECT
is done, but with a warning. The UPDATE
leads to an error.
I have to cut of the 'b' before.
My field contains 2 patterns of not convertable strings: '15b' or '02, 03'. I am only interested in the digits at the begin: '15b' => 15, '02, 03' => 2. So I had to cut of everthing behind:
UPDATE product_translation
SET custom_fields = JSON_INSERT(custom_fields, '$."sorting"', CAST(REGEXP_SUBSTR(JSON_EXTRACT(custom_fields, '$."product_attr4"'), '[0-9]+') AS SIGNED))
WHERE JSON_CONTAINS_PATH(custom_fields, 'one', '$."product_attr4"')