SQL Language (MOSC)

MOSC Banner

The comparison on ' ' into "case when" conditions on union sighting with constants in the array list

edited May 30, 2012 1:24AM in SQL Language (MOSC) 5 commentsAnswered
SQL-Example:

create
table test_rf (MEKZ NCHAR(2), id int);

-- Datarecord with 1 space

insert
into test_rf values (N' ', 1);

--
Create View
create
or replace view test_rf1 as
       select
N' ' as MEKZ , id, 'cons'  as typ from test_rf
union
all
       select
MEKZ, id, 'data' as typ from test_rf  


select
id, case when MEKZ = N' ' then 'EMTPY' else 'NOTEMPTY' end as MEKZ_STATE, typ from test_rf1

Result:
ID MEKZ_STATE TYP
1  EMTPY      cons
1  NOEMPTY    data



Expects war is have here all data records in the field the MEKZ condition cave EMPTY value

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center