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: 15 Sep 1999 03:26:06 GMT
Message-ID: <7rn3ke$oaq15@imsp212.netvigator.com>


So, <> '' is same as <> NULL which is useless in PL/SQL, am I right?

Michel Cadot <micadot_at_netcourrier.com> wrote: : No, you can't use that because " is not '' " is not : part of the SQL syntax, you have to use " is not null ".

: When i say '' is the same as null, i just mean that ''
: indicates a null string as the keyword null does.
: See:

: v734>l
:   1  declare
:   2  begin
:   3  if '' is not null then
:   4  dbms_output.put_line(''''' is not null');
:   5  else
:   6  dbms_output.put_line(''''' is null');
:   7  end if;
:   8* end;

: v734>/
: '' is null

: PL/SQL procedure successfully completed.

: Norris a écrit dans le message <7rlhi1$77u2_at_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/

--
--
http://www.washington.edu/pine/faq/ Received on Tue Sep 14 1999 - 22:26:06 CDT

Original text of this message

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