如何更新此存储过程?

时间:2017-09-18 11:54:33

标签: mysql stored-procedures

这是我在存储过程中更新2表的代码

 DROP PROCEDURE IF EXISTS `SP_ENGG_UPDATE_ITEM_SERVICE`;
    DELIMITER $$

    CREATE PROCEDURE `SP_ENGG_UPDATE_ITEM_SERVICE`(
    IN `p_uid` BIGINT(20) UNSIGNED,
    IN `p_sid` BIGINT(20) UNSIGNED, 
    IN `p_sdid` BIGINT(20) UNSIGNED, 
    IN `p_mediaJson` TEXT, 
    IN `p_itemStatus` TINYINT(1), 
    IN `p_mediavalue` TEXT)
    BEGIN
    DECLARE stcount  int DEFAULT 0;
    DECLARE ttcount int DEFAULT 0;
    SET @updated = 0;
    IF(p_sid > 0 && p_sdid > 0 ) THEN
        UPDATE user_service_details SET
             p_mediavalue = p_mediaJson,
            status = p_itemStatus
        WHERE user_service_id = p_sid  AND  id =p_sdid;

        SET stcount = (SELECT count(*) FROM user_service_details WHERE user_service_id = p_sid AND status = 2 );
        SET ttcount = (SELECT count(*) FROM user_service_details WHERE  user_service_id= p_sid );   

        IF (stcount = ttcount) THEN
            UPDATE user_service SET
                status= 4
            WHERE id = p_sid AND engg_id = p_uid ;
        END IF;
        SET @updated = 1;   
    END IF;
    SELECT @updated;
    END

这是我要更新的查询

call SP_ENGG_UPDATE_ITEM_SERVICE(252317018022627,25231702221634,252302221637,
'{"images":["img1.png","img2.png","img3.png"],"videos":["vid1.mp4","vid2.mp4","vid3.mp4"],"audios":["aud1.mp3","aud2.mp3","aud3.mp3"]}',2,'before_image');

当我尝试更新此错误时显示: -

Error Code: 1054 Unknown column 'p_mediavalue' in 'field list'  

任何人都知道如何更新。

1 个答案:

答案 0 :(得分:0)

Office.context.mailbox.item.body.getTypeAsync(function (result) { ... } 中的列名user_service_details根据引发的错误"未知列名"而错误。