当前位置:首页 > 开发 > 数据库 > 正文

oracle if else

发表于: 2012-09-29   作者:blackproof   来源:转载   浏览:
摘要: oracle中的if else     if instr(pagesql,'group by') >= 1 then v_sql := 'select * from ('||pagesql||') where rn between '||v_pb||' and '||v_pd; else if instr(pagesql,'where')

oracle中的if else

 

 

 if instr(pagesql,'group by') >= 1 then
      v_sql := 'select * from ('||pagesql||') where rn between '||v_pb||' and '||v_pd;
     else if instr(pagesql,'where') >= 1 
      then  v_innner_sql := pagesql||' and rownum <= '||v_pd; v_sql:='select * from ('||v_innner_sql||') where rn >='||v_pb;
     else
       v_innner_sql := pagesql || ' where rownum <= '|| v_pd; v_sql:='select * from ('||v_innner_sql||') where rn >='||v_pb;
     end if;
     end if;

 网上搜可以用elseif,可是根本不成啊,不知道怎么回事

 最后用上边的方法搞定了

后来才知道是elsif,所以上边可以直接用

 

 if instr(pagesql,'group by') >= 1 then
       v_sql := 'select * from ('||pagesql||') where rn between '||v_pb||' and '||v_pd;
 elsif instr(pagesql,'where') >= 1 then
       v_innner_sql := pagesql||' and rownum <= '||v_pd; v_sql:='select * from ('||v_innner_sql||') where rn >='||v_pb;
 else
       v_innner_sql := pagesql || ' where rownum <= '|| v_pd; v_sql:='select * from ('||v_innner_sql||') where rn >='||v_pb;
 end if;

 

oracle if else

  • 0

    开心

    开心

  • 0

    板砖

    板砖

  • 0

    感动

    感动

  • 0

    有用

    有用

  • 0

    疑问

    疑问

  • 0

    难过

    难过

  • 0

    无聊

    无聊

  • 0

    震惊

    震惊

版权所有 IT知识库 CopyRight © 2009-2015 IT知识库 IT610.com , All Rights Reserved. 京ICP备09083238号