database - IF STATEMENT IN MYSQL INSERT is not working -


please, not understand why not working:

    set @key = (select customer.key_stamp customer customer.key_stamp = "0000");     case when (@key > 0)          insert transaction                                 (transaction.to, transaction.key, transaction.type, transaction.cost_bitcoin, transaction.quantity)                                 values ("0000", "f5rwsd", 2, 0.0075,                                          (500000 +                                              (                                                 (select bonus.amount                                                     bonus                                                     500000 between bonus.min_quantity , bonus.max_quantity                                                 ) / 500000                                             ) * 100))     end; 

i tried case statement, still not work, , can't understand issue. please help.

case not valid mysql statement. (it's not valid statement outside context of mysql stored program.)

"why not work"... because it's not valid sql.

a case expression can used in sql statement expression allowed. (in sql, expression returns value of particular datatype.)


as example of using case expression in sql statement, this:

select case when @key > 0 'somevalue' else 'othervalue' end foo 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -