Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: oracle 9i sql DECODE
abhishek.ankur_at_gmail.com wrote:
> Hi everyone,
> I want to know that can we check for NULL and NOT NULL conditions in
> DECODE
> like the syntax for DECODE is
> DECODE(expr,value,substitution)
> What I am doing is use some value in expr which needs to be checked for
> NULL and NOT NULL. If the expr is NULL then some value should be used
> for expr and if it is not null then some other value should be used.
>
> CAn this be done???? and if yes how??
> plz help
SQL> select version from v$instance;
VERSION
SQL> drop table t;
Table dropped.
SQL> create table t (t1 varchar2(10));
Table created.
SQL> insert into t values ('');
1 row created.
SQL> insert into t values ('BOB');
1 row created.
SQL> select decode(t1, null, 'THIS IS NULL', t1) 2 from t;
DECODE(T1,NU
Regards,
IM
Received on Tue Sep 19 2006 - 06:01:55 CDT
![]() |
![]() |