plsql的初级提问

永远的326 2008-11-03 05:12:23
我想判断一个字符串,如果为null,将""赋值给它。

如果用java表示则为:
例如有字符串s
if(s==null){
s="";
}

同样功能的plsql怎么写呢?
...全文
110 15 打赏 收藏 转发到动态 举报
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
MyHoliday_2008 2008-11-06
  • 打赏
  • 举报
回复
nvl(arg,value) 代表如果前面的arg的值为null那么返回的值为后面的value
gdqsh 2008-11-06
  • 打赏
  • 举报
回复
存储过程中
if s is null then
s:="";
end if;
bufan2162 2008-11-06
  • 打赏
  • 举报
回复
学习了。
zfg2003 2008-11-05
  • 打赏
  • 举报
回复
IF a IS NULL THEN
a := '';
END IF;
jakqigle 2008-11-04
  • 打赏
  • 举报
回复
可以用NVL()函数:NVL(s,'')
taxmma 2008-11-03
  • 打赏
  • 举报
回复
对oracle里有NVL函数的
可以在plsql里用:

select nvl(s,'') into s from dual;

-- 或者
if s is null then
s := '';
end if;
icss_zhen 2008-11-03
  • 打赏
  • 举报
回复
nvl(s,'')或decode(s,null,'',s);
tianyazifan 2008-11-03
  • 打赏
  • 举报
回复
oracle由函数的,我记得是ISNULL(Test, "")


得分咯~~~o(∩_∩)o...
wangsong145 2008-11-03
  • 打赏
  • 举报
回复
if s is null then
s:="";
end if;
codearts 2008-11-03
  • 打赏
  • 举报
回复

if s is null then
s := ' ';
end if;
gisinfo 2008-11-03
  • 打赏
  • 举报
回复
decode(s,null,9,8)


函数的意思是 字段S是空的话 赋予9 不是的话就8

如果你只对空做判断第四个参数可以不要

和3楼是一样的效果
szflower 2008-11-03
  • 打赏
  • 举报
回复
nvl(s,'''''''''')
看不清楚""
nvl(s,'')
gisinfo 2008-11-03
  • 打赏
  • 举报
回复
判断空的函数
nvl(字段,9)
9就是你 赋予的值
YY_MM_DD 2008-11-03
  • 打赏
  • 举报
回复
decode(s,null,'')
BlueskyWide 2008-11-03
  • 打赏
  • 举报
回复
update table_test set field1='' where field1 is null;



[Quote=引用楼主 chain99081 的帖子:]
我想判断一个字符串,如果为null,将""赋值给它。

如果用java表示则为:
例如有字符串s
if(s==null){
s="";
}

同样功能的plsql怎么写呢?
[/Quote]

17,377

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 基础和管理
社区管理员
  • 基础和管理社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧