select seq_lt_id.nextval,code,cdescription,(case clevel when  null then 1 end) )
from noahark.v_noah_flex_com;这样写可以吗?

解决方案 »

  1.   

    case when clevel is null then 1 end 
    如果没有其他分支,用nvl多简单啊。
      

  2.   

    select seq_lt_id.nextval,code,cdescription,case clevel when is null then 1 when not null then clevel end 
    from noahark.v_noah_flex_com;帮我看看这句话哪有毛病? 谢谢了.
      

  3.   

    oracle里面好像没有not null哦!你要用的话,得用is not null
    例:
    select comm from emp where comm is not null
      

  4.   

    case clevel when is null then 1 when not null then clevel end 有问题:case when clevel is null then 1 else clevel end 
    用 nvl(clevel , 1)
      

  5.   

    用这个也可以
    case when null then 1 else clevel end 这个是不可以的
    case when not null then 1 else clevel end 非要用not null,可以这样写
    case when clevel is not null then 1 else clevel end
      

  6.   

    nvl(clevel , 1)decode(clevel,null,1,clevel)
      

  7.   

    求救高手,看看这种情况是哪里的错误?谢谢了.
    create or replace procedure Pro_test_3 as
    begin
    insert into huhb (cs_name,srid,auth_srid ,auth_name,wktext) select  (cs_name,srid,case when auth_srid = 1 then 11 when auth_srid = 2 then 22 when auth_srid = 3 then 3 when auth_srid = 4 then 44 end ,auth_name,wktext)from ttest_1 ;
    commit;
    end;
      

  8.   

    create or replace procedure Pro_test_3 as
    begin
    insert into huhb (cs_name,srid,auth_srid ,auth_name,wktext) select  cs_name,srid,case when auth_srid = 1 then 11 when auth_srid = 2 then 22 when auth_srid = 3 then 3 when auth_srid = 4 then 44 end ,auth_name,wktext from ttest_1 ;
    commit;
    end;---or:create or replace procedure Pro_test_3 as
    begin
    insert into huhb (cs_name,srid,auth_srid ,auth_name,wktext) 
    select  cs_name,srid,
      case auth_srid when 1 then 11 when 2 then 22 when 3 then 3 when 4 then 44 /*else ?*/end ,
      auth_name,wktext
    from ttest_1 ;
    commit;
    end;
      

  9.   

    select  (cs_name,srid,case when auth_srid = 1 then 11 when auth_srid = 2 then 22 when auth_srid = 3 then 3 when auth_srid = 4 then 44 end ,auth_name,wktext)from ttest_1
    这叫啥语法啊。 from 前面连空格都没有
      

  10.   

    create or replace procedure Pro_test_3 as
    begin
    insert into huhb (cs_name,srid,auth_srid ,auth_name,wktext) 
    select  cs_name,srid,
      case auth_srid when 1 then 11 when 2 then 22 when 3 then 3 when 4 then 44 /*else ?*/end ,
      auth_name,wktext
    from ttest_1 ;
    commit;
    end;
    这样写还是编译不过去.
      

  11.   

    这样写还是编译不过去
    --什么错误单独看case应该没有错误了
    select  
      case 1 when 1 then 11 when 2 then 22 when 3 then 3 when 4 then 44 /*else ?*/end
    from dual ;
    --结果11
      

  12.   

    create or replace procedure Pro_test_3 as
    begin
    --insert into huhb (cs_name,srid,auth_srid ,auth_name,wktext) select  (cs_name,srid,case when auth_srid = 1 then 11 when auth_srid = 2 then 22 when auth_srid = 3 then 3 when auth_srid = 4 then 44 end ,auth_name,wktext) from ttest_1 ;
     insert into huhb (cs_name,srid,auth_srid ,auth_name,wktext)
     select  (cs_name,srid,
     case auth_srid when 1 then 11 when 2 then 22 when 3 then 3 when  4 then 44 end ,auth_name,wktext)
     from ttest_1 ;
    commit;
    end;这个是我写的语句,我在SQL WINDOWS窗口里编译,按F8也不提示什么?就是左边存储过程名那是叉.
      

  13.   

    知道问题所在了,就是在select 后加()的原因.
    我感觉加()应该没什么问题.但是我把()去了就行了.怪不怪.谢谢了,
      

  14.   

    select seq_lt_id.nextval,code,cdescription,case clevel when null then '1'     else  'clevel' end 
    from noahark.v_noah_flex_com;