创建表上的MySQL错误 - 截断不正确的双值?

时间:2017-02-01 15:35:58

标签: mysql sql

我有以下存储过程,在调用它时一直给我带来问题。 select语句单独执行时效果很好,创建存储过程也是如此。但是当我" call();"我收到以下错误:

查找错误 - MySQL数据库错误:截断错误的DOUBLE值:' 0g'

这是存储过程。有没有人看到可能导致此错误的原因?

DROP PROCEDURE IF EXISTS test.clients_shipments_with_line_weight_refresh_sp;

CREATE PROCEDURE test.`clients_shipments_with_line_weight_refresh_sp`()
BEGIN
   DROP TABLE IF EXISTS clients_shipments_with_line_weight;
   CREATE TABLE clients_shipments_with_line_weight
   AS
      (SELECT reg_client_shipments.*,
              wow3.meta_value AS cannabis_type,
              (wow2.meta_value * wp_wowcomm_order_itemmeta.meta_value)
                 AS total_line_item_weight,
              pm3.meta_value   AS province
       FROM clients_shipments
            INNER JOIN wp_postmeta pm2
               ON clients_shipments.ID = pm2.post_id
            INNER JOIN wp_postmeta pm3
               ON     clients_shipments.ID = pm3.post_id
                  AND pm3.meta_key = 'statedeliver'
            INNER JOIN wp_wowcomm_order_items
               ON     wp_wowcomm_order_items.order_id =
                         clients_shipments.ID
                  AND wp_wowcomm_order_items.order_item_type =
                         'product'
            INNER JOIN wp_wowcomm_order_itemmeta
               ON     wp_wowcomm_order_items.order_item_id =
                         wp_wowcomm_order_itemmeta.order_item_id
                  AND wp_wowcomm_order_itemmeta.meta_key = 'weight'
            INNER JOIN wp_wowcomm_order_itemmeta wow2
               ON     wp_wowcomm_order_items.order_item_id =
                         wow2.order_item_id
                  AND wow2.meta_key = 'amount'
            INNER JOIN wp_wowcomm_order_itemmeta wow3
               ON     wp_wowcomm_order_items.order_item_id =
                         wow3.order_item_id
                  AND wow3.meta_key = 'producttype'
       GROUP BY wp_wowcomm_order_itemmeta.meta_id);
END;

1 个答案:

答案 0 :(得分:1)

这个答案表明你可以比较where或on子句中的数字或字符串。

https://stackoverflow.com/a/16069446/409556

你选择Statment看起来非常像它可能正在这样做。 OP建议删除严格,因此它会变成警告。