存储过程返回0条记录

时间:2016-08-22 00:08:55

标签: mysql stored-procedures

已创建以下存储过程。我已经在线研究了解为什么当我调用存储过程时,当应该有行时我会受到0行的影响。

DELIMITER $$

    DROP PROCEDURE IF EXISTS `sgr_leena`.`test` $$

    CREATE PROCEDURE `sgr_leena`.`test` ()
BEGIN
    DECLARE id char(36);
    DECLARE parent_id char(36);
    DECLARE ird_number nvarchar(20);

UPDATE sgr_leena.tasks 
     SET parent_id = @parent_id 
     WHERE parent_id IN (SELECT id_c FROM sgr_leena.accounts_cstm 
     WHERE ird_number_c = @ird_number and
     keeper_c='Keeper');

UPDATE sgr_leena.calls
     SET parent_id = @parent_id 
     WHERE parent_id IN (SELECT id_c FROM sgr_leena.accounts_cstm 
     WHERE  ird_number_c = @ird_number and
     keeper_c='Keeper');

UPDATE sgr_leena.meetings
     SET parent_id = @parent_id 
     WHERE parent_id IN (SELECT id_c FROM sgr_leena.accounts_cstm 
     WHERE ird_number_c = @ird_number and
     keeper_c='Keeper');

UPDATE sgr_leena.notes
     SET parent_id = @parent_id 
     WHERE parent_id IN (SELECT id_c FROM sgr_leena.accounts_cstm 
     WHERE ird_number_c = @ird_number and
     keeper_c='Keeper');

UPDATE sgr_leena.emails
     SET parent_id = @parent_id 
     WHERE parent_id IN (SELECT id_c FROM sgr_leena.accounts_cstm 
     WHERE ird_number_c = @ird_number and
     keeper_c='Keeper');

UPDATE sgr_leena.accounts_accounts_1_c
     SET accounts_accounts_1accounts_idb = @parent_id 
     WHERE accounts_accounts_1accounts_idb IN (SELECT id_c FROM    sgr_leena.accounts_cstm 
     WHERE ird_number_c = @ird_number and
     keeper_c='Keeper');

UPDATE sgr_leena.accounts_contacts_1_c
     SET accounts_contacts_1accounts_ida = @parent_id 
     WHERE accounts_contacts_1accounts_ida IN (SELECT id_c FROM sgr_leena.accounts_cstm 
     WHERE ird_number_c = @ird_number and
     keeper_c='Keeper');

END $$

DELIMITER ;

存储过程调用我正在使用调用sgr_leenatest

我已经研究过使用IN参数,但是在运行存储过程时不想调用ird​​_number。

我想运行存储过程,以便根据IRD编号使用keeper id更新父ID。

0 个答案:

没有答案