创建函数

创建函数:

create or replace FUNCTION F_jishubu(userid IN VARCHAR2)

  RETURN number is

  v_result number;

BEGIN

  select count(*) amount

  into v_result

   from user_info

  where user_id=userid

  and org_id in (SELECT org_id FROM org_info 

  START WITH org_id = '11010760' CONNECT BY PRIOR org_id = parent_org_id);

  RETURN v_result;

END F_jishubu;

如果有判断:

if 条件 then

  执行语句

else

  执行语句

end if;

猜你喜欢

转载自577439237.iteye.com/blog/2281053