create or replace function getAuth(processName in varchar2,activityName in varchar2,userId in number)
return varchar2 is
FieldShowName VARCHAR2(2000);
FieldType VARCHAR2(255);
begin
select a.field_show_name , b.type into FieldShowName ,FieldType from bas_bpm_form_table a
join bas_role_table_type b on a.id = b.table_id
join bas_security_role c on b.role_id = c.id
join bas_security_user d on c.id = d.id
where a.processname=processName and a.activityname=activityName and d.id=userId and rownum<=1;
return FieldShowName || FieldType ;
end;
select getauth('HETONG','create',2) from dual
以上两个问题都包含了,请认真查看
select into 是复制表,不是给变量赋值啊哥哥
select a.field_show_name , b.type into FieldShowName ,FieldType这里改成
select FieldShowName=a.field_show_name , FieldType=b.type
+要改成||,再试一试?
你这个函数,只能返回一个值,所以每次只能查一条记录。要是想查多条记录,需要把函数的返回类型改成表变量。
create or replace function getAuth(processName varchar2,activityName varchar2,userId number)
return varchar2 is
FieldShowName VARCHAR2(2000);
FieldType VARCHAR2(255);
begin
select a.field_show_name , b.type into FieldShowName ,FieldType from bas_bpm_form_table a
join bas_role_table_type b on a.id = b.table_id
join bas_security_role c on b.role_id = c.id
join bas_security_user d on c.id = d.id
where a.processname=processName and a.activityname=activityName and d.id=userId and rownum<=1;
return FieldShowName || FieldType ;
end;