开发者

How to call a Stored Procedure from another Stored Procedure in mysql?

开发者 https://www.devze.com 2023-02-05 11:00 出处:网络
Can I do that because it call from function if i use a norm开发者_如何学Cal form such as xxx() in mysql? please show me how to do it,thx.In SQL Server it is plain vanilla exec proc statement, here is

Can I do that because it call from function if i use a norm开发者_如何学Cal form such as xxx() in mysql? please show me how to do it,thx.


In SQL Server it is plain vanilla exec proc statement, here is sql server syntax

create procedure prYourProc
as

-- exec other proc
exec prSomeOtherProc

-- to get return value
declare @var int
exec @var = prSomeOtherProc


PROCEDURE 1

DROP PROCEDURE IF EXISTS Proc1;
CREATE PROCEDURE Proc1()
BEGIN
  CALL Proc2();
END

PROCEDURE 2

DROP PROCEDURE IF EXISTS Proc2;
CREATE PROCEDURE Proc2()
BEGIN
  SELECT ColumnName  FROM table2;
END
0

精彩评论

暂无评论...
验证码 换一张
取 消