sql 函数和过程,

1:定义函数

create function A_count(id int)
    returns integer
    begin
    declare d_count integer;
        select count(*) into d_count from A where A.id<3
        return d_ocunt;
    end

  使用函数

   select name from A where A_count(id)>2;

猜你喜欢

转载自www.cnblogs.com/liyafei/p/9270598.html
今日推荐