Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: <> '' in PL/SQL

Re: <> '' in PL/SQL

From: Norris <johnnie_at_cooper.com.hk>
Date: 14 Sep 1999 13:11:29 GMT
Message-ID: <7rlhi1$77u2@imsp212.netvigator.com>


If '' is the same as NULL then can I use: " is not '' " instead of " is not null " ?

Michel Cadot <micadot_at_netcourrier.com> wrote:

: You have to change <> '' to is not null.
: As a matter of fact, '' is the same as NULL in PL/SQL
: so <> '' cannot be true and else part is execute.

: v734>l
:   1  declare
:   2  abc varchar2(1);
:   3  begin
:   4  abc := 'a';
:   5  if abc is not null then
:   6  dbms_output.put_line(abc||' <> empty');
:   7  else
:   8  dbms_output.put_line(abc||' = empty');
:   9  end if;
:  10* end;

: v734>/
: a <> empty

: PL/SQL procedure successfully completed.

: Norris a écrit dans le message <7rl8s6$4qs$1_at_adenine.netfront.net>...

:>I am writing some simple PL/SQL , but I cannot intepret the result:
:>
:>set serveroutput on
:>declare
:>abc varchar2(1);
:>begin
:>abc := 'a';
:>if abc <> '' then
:> dbms_output.put_line(abc||' <> empty');
:>else
:> dbms_output.put_line(abc||' = empty');
:>end if;
:>end;
:>
:>
:>The Result
:>----------
:>ServerOutput ON
:>Statement processed.
:>a = empty
:>
:>
:>
:>
:>
:>
:>--
:>- Have several nice days...
:>- Opinions are mine and do not necessarily reflect those of the Corp.
:>http://www.ntfaq.com
:>http://www.cyberport.com/~tangent/programming/winsock/

--
--
http://www.washington.edu/pine/faq/ Received on Tue Sep 14 1999 - 08:11:29 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US