0

We were updating column value based on col 'string_hash_id' value, but we couldn't get through: Error Code: 1815. Internal error: CAL0002: Update Failed: TreeNode::getDecimalVal: non-support conversion from string

sql:

UPDATE table1 JOIN table2 USING(id)
SET table1.calc_col = table_1.col1 * table_1.col2 * table.col3 * ((100 - (
CASE col_id WHEN 'string_hash_id' THEN 2.00 ELSE 1.5 END)) * 0.01)

col1 is signed int, rest of cols are decimal

We thought that if we cast these cols it will work but nothing happens error was the same. But when we changed case values to string it works but it does not make any sense.

THEN 2.00 ELSE 1.5 ==> THEN '2.00' ELSE '1.5'

UPDATE table1 JOIN table2 USING(id)
SET table1.calc_col = table_1.col1 * table_1.col2 * table.col3 * ((100 - (
CASE col_id WHEN 'string_hash_id' THEN '2.00' ELSE '1.5' END)) * 0.01)

And my question is, how is this possible and why it shows TreeNode::getDecimalVal: non-support conversion from string when there is no string.

And works without issues when there is string.

1 Answer 1

1
WHEN 'string_hash_id' THEN 

-->

WHEN `string_hash_id` THEN

Apostrophes and double-quotes are for strings; backtics are for column names.

1
  • string_hash_id contains string, it is not column name Commented Feb 4, 2019 at 8:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.