Hi,
Why does not work DECODE on a json column in a view?
drop table if exists decode_test;
create table decode_test (
id int
,data_json json
,data_vchar varchar(16)
);
insert into decode_test (id) values (1);
drop view if exists decode_test_view;
create view decode_test_view(decode_json, decode_json_as_lvchar, decode_vchar, id, data_json, data_vchar) as
select
DECODE(data_json, null, 0, 1)
,DECODE(data_json::lvarchar, null, 0, 1)
,DECODE(data_vchar, null, 0, 1)
,id, data_json, data_vchar
from decode_test
;
select
DECODE(data_json, null, 0, 1)
,DECODE(data_json::lvarchar, null, 0, 1)
,DECODE(data_vchar, null, 0, 1)
,id, data_json, data_vchar
from decode_test
;
|decode_json|decode_json_as_lvchar|decode_vchar|id |data_json|data_vchar|
|-----------|---------------------|------------|---|---------|----------|
|0 |0 |0 |1 |null |null |
select * from decode_test_view;
|decode_json|decode_json_as_lvchar|decode_vchar|id |data_json|data_vchar|
|-----------|---------------------|------------|---|---------|----------|
|1 |1 |0 |1 |null |null |
Using
Informix 14.10FC11
Informix 15.0.1.7
BR
Emanuel