如何在mysql中将一个过程的值转换为另一个过程

时间:2016-02-26 06:26:35

标签: mysql sql

我有两个程序,即“createOrder”和“createAndress”

在“createOrder”程序中,我有4个IN参数和1个参数。

在“createAndress”程序中,我有3个IN参数和1个参数。

我在“createOrder”程序中调用“createAndress”,如下所示

CALL create_address (in_userprofile_id, in_pin, true, in_address_id);

但如何将“createAndress”的值输入“createOrder”程序?

1 个答案:

答案 0 :(得分:0)

CreateOrder存储过程

中进行此操作
 -- Declare the variable to receive the output value of the procedure.
      DECLARE @OutParameterForCreateAddress INT;
 -- Execute the procedure specifying in_userprofile_id, in_pin, true,in_address_id for the input parameter
 -- and saving the output value in the variable @OutParameterForCreateAddress 
      EXECUTE create_address in_userprofile_id, in_pin, true, in_address_id,    @YourOutParameterNameinCreatedAddress = @OutParameterForCreateAddress OUTPUT;
 -- Display the value returned by the procedure.
      Print @OutParameterForCreateAddress 
相关问题