when we create sp in Netezza, we may be assign value by 'nvl(row_id,0)'.
Eg:
DECLARE vStart_ro_id bigint;
BEGIN vStart_ro_id : = (select nvl(row_id,0) + 1 from table where job_name = 'xxx')
But when there is no records satisfied this condition, the value of vStart_ro_id is null. However we want to get 1. So we can do like this :
BEGIN vStart_ro_id : = (select nvl(max(row_id),0) + 1 from table where job_name = 'xxx')
Now check the value of vStart_ro_id. Good Luck ~~
本文介绍了在使用Nevaza创建SpinNet时,通过使用'nvl(row_id,0)'函数进行高效赋值的方法。特别讨论了在数据为空时如何确保初始值为1,避免了因NULL值导致的问题。通过实例演示,帮助开发者理解并应用这一技巧。
825

被折叠的 条评论
为什么被折叠?



