oracle 数据库 if...elsif...语句

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;

       

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。