Oracle Database If...elsif ... Statement

Source: Internet
Author: User

CREATE OR REPLACE FUNCTION "Ufn_getids" (Opekind in VARCHAR2,--query type PARAMS in varchar2--query field) RETURN Clob is Str_return clob;--varchar2 (30000);

BEGIN      if      opekind = ' 1 '    then      & nbsp 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      & nbsp;       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     & nbsp;        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      & nbsp;       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 the 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;

Oracle Database If...elsif ... Statement

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.