Home > Database > Mysql Tutorial > body text

Oracle一则诡异的程序

WBOY
Release: 2016-06-07 17:45:47
Original
875 people have browsed it

function chkA_B return varchar2 as

  a   varchar2(10):=NULL;

  b   varchar2(10):='1';

  begin

  if a=b then

  return 'Error';

  end if;

  return 'ok';

  end;

  这段程序诡异地返回ok,而不是Error. 通过跟踪,程序进入了 return 'error' .但是紧接着也执行了return 'ok'.

  如果将if 的条件改为 if nvl(a,'0')=b 则程序正常。

 

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template