我想判断一个字符串,如果为null,将""赋值给它。如果用java表示则为:
例如有字符串s
if(s==null){
s="";
}同样功能的plsql怎么写呢?

解决方案 »

  1.   

    update table_test set field1='' where field1 is null;
      

  2.   

    判断空的函数
    nvl(字段,9)
    9就是你 赋予的值
      

  3.   

    nvl(s,'''''''''')
    看不清楚""
    nvl(s,'')
      

  4.   

    decode(s,null,9,8)
    函数的意思是 字段S是空的话 赋予9 不是的话就8如果你只对空做判断第四个参数可以不要和3楼是一样的效果
      

  5.   


    if s is null then
      s := ' ';
    end if;
      

  6.   

    if s is null then
    s:="";
    end if;
      

  7.   

    oracle由函数的,我记得是ISNULL(Test, "")
    得分咯~~~o(∩_∩)o...
      

  8.   

    对oracle里有NVL函数的
    可以在plsql里用:select nvl(s,'') into s from dual;-- 或者
    if s is null then
      s := '';
    end if;
      

  9.   

    可以用NVL()函数:NVL(s,'')
      

  10.   

     IF a IS NULL THEN 
        a := '';
     END IF;
      

  11.   

    存储过程中
    if s is null then 
    s:=""; 
    end if;
      

  12.   

    nvl(arg,value)  代表如果前面的arg的值为null那么返回的值为后面的value