CREATE OR REPLACE FUNCTION "UFN_GETIDS" ( OPEKIND IN VARCHAR2,-- 查询类型 PARAMS IN VARCHAR2-- 查询字段 ) RETURN clob IS str_return clob;--varchar2(30000);
BEGIN if OPEKIND = ‘1‘ then declare Cursor cusor1 is SELECT ………………; begin for x in cusor1 loop str_return := str_return || x.OUID || ‘,‘; end loop; end;
elsif OPEKIND = ‘2‘ then declare Cursor cusor1 is SELECT ……………………; begin for x in cusor1 loop str_return := str_return || x.OILDOMID || ‘,‘; end loop; str_return:= substr(str_return,0,length(str_return)-1); end;
elsif OPEKIND = ‘3‘ then declare Cursor cusor1 is SELECT ………………; begin for x in cusor1 loop str_return := str_return || x.OILDOMID || ‘,‘; end loop; str_return:= substr(str_return,0,length(str_return)-1); end;
elsif OPEKIND = ‘4‘ then declare Cursor cusor1 is SELECT ……………………; begin for x in cusor1 loop str_return := str_return || x.OILDOMID || ‘,‘; end loop; str_return:= substr(str_return,0,length(str_return)-1); end;
elsif OPEKIND = ‘5‘ then declare Cursor cusor1 is SELECT …………………………; begin for x in cusor1 loop str_return := str_return || x.OILDOMID || ‘,‘; end loop; str_return:= substr(str_return,0,length(str_return)-1); end; end if;
RETURN str_return; END;