ITPub博客

首页 > Linux操作系统 > Linux操作系统 > oracle [case] [delete]

oracle [case] [delete]

原创 Linux操作系统 作者:sieper 时间:2010-07-14 13:39:55 0 删除 编辑

case用法很简单,但是平时很少用,由此被问起竟忘了具体语法。

create table t1 (id number);
insert into t1(id) select level from dual connect by level<5;
commit;
select case id
         when 1 then
          'a'
         when 2 then
          'b'
         else
          'c'
       end,
       id
  from t1;
select case
         when id = 1 then
          'a'
         when id = 2 then
          'b'
         when id between 3 and 4 then
          'c'
       end,
       id
  from t1;
drop table t1 purge;

 

delete 的语法是delete from  table  同时delete table也可以。

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/11813230/viewspace-667989/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2009-03-17

  • 博文量
    87
  • 访问量
    210539