arthur1980 发表于 2008-06-02 09:36

在存储过程中如何调用存储过程

我想在一个存储过程中调用其他存储过程给我变量赋值,请问语句该怎么写?

xxyyy 发表于 2008-06-02 09:51

没有返回值,没有参数:
call procedure_name( );

有参数无返回值:
call procedure_name( args ...);

有参数,有返回值:
call procedure_name( args ...) returning a , b ,...;

有参数,返回值为多行(结果集):
foreach
    execute procedure procedure_name( args ...)
         into a,b....

....
end foreach;

[ 本帖最后由 xxyyy 于 2008-6-3 08:44 编辑 ]

arthur1980 发表于 2008-06-02 10:01

谢谢,我试一下

arthur1980 发表于 2008-06-02 10:06

呵呵,谢谢楼上,不过赋值好像是用returning

大梦 发表于 2008-06-02 21:52

create procedure give_discount(p_customer_num integer)
define p_order_num integer;
call get_biggest_order(p_customer_num)
returning p_order_num;
--more code goes here
end procedure;
页: [1]
查看完整版本: 在存储过程中如何调用存储过程