oracle空串比较

2014-11-24 17:02:25 · 作者: · 浏览: 0
oracle空串比较
declare 
  len_x integer; 
  len_y integer; 

begin 

  select nvl(length(trim('')), 0) into len_x from dual; 

  select nvl(length(trim(null)), 0) into len_y from dual; 
  
  dbms_output.put_line('len_x=' || len_x); 
  dbms_output.put_line('len_y=' || len_x); 

  if len_x = len_y then 
    dbms_output.put_line('1111'); 
  else 
    dbms_output.put_line('2222'); 
  end if; 
end;