on 2014 Mar 25 7:19 PM
select c1, c2, c3,
( CASE when recon-status = '' then 'N'
when recon-status is null then 'NULL'
else recon-status END )
from ...
when recon_status = '', i'm not getting an N, i'm getting ''
ASA 11.0.1.2960
The question remains, how do you know that recon_status contains ''? Maybe it contains ' ' or ' ' (one or two or more spaces)... you can't tell from the screenshots.
Maybe you need TRIM...
( case when TRIM ( recon_status ) = '' then 'N' when recon_status is null then 'NULL' else recon_status end ) recon_status,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Check your work. It returns 'N' for the same version of SQL Anywhere, regardless of whether dbinit -b was specified or not...
begin declare recon_status CHAR ( 10 ); set recon_status = ''; select @@VERSION, case when recon_status = '' then 'N' when recon_status is null then 'NULL' else recon_status end as recon_status; end; -- dbinit with -b @@VERSION,recon_status '11.0.1.2960','N' -- dbinit without -b @@VERSION,recon_status '11.0.1.2960','N'
This also works as expected...
begin select @@VERSION, case when recon_status = '' then 'N' when recon_status is null then 'NULL' else recon_status end as recon_status FROM ( SELECT '' AS recon_status ) AS t; end;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
IMHO, a test on an empty string does work as expected with SA 12.0.1:
begin declare recon_status varchar; set recon_status = ''; select case when recon_status = '' then 'N' when recon_status is null then 'NULL' else recon_status end as recon_status; end;
returns 'N'. And it would be very surprising if it did not, well, at least as long as SQL Anywhere won't follow Oracle's "treat an empty string as null" misconception concept...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
71 | |
10 | |
10 | |
7 | |
7 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.