Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: <> '' in PL/SQL
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/
Received on Tue Sep 14 1999 - 07:22:48 CDT
![]() |
![]() |