SQL CASE function returns odd dada

General discussion on Zend Core for IBM System i
Post Reply
dburdette
Posts: 10
Joined: Tue Mar 30, 2010 4:48 pm

SQL CASE function returns odd dada

Post by dburdette » Tue Mar 30, 2010 5:10 pm

I have the following SQL Code:

SELECT BMA0CD, AJBXTX, BMBJCD, AOAHNA,
CASE
WHEN AORLSU='A' THEN 'Active'
WHEN AORLSU='I' THEN 'In-Active'
WHEN AORLSU='O' THEN 'Obsolete'
END
AS RUMMY
FROM TSBMCPP
INNER JOIN TPAJREP
ON TSBMCPP.BMA0CD=TPAJREP.AJA0CD
INNER JOIN TPAOREP
ON TSBMCPP.BMBJCD=TPAOREP.AOBJCD

And the field RUMMY gets returned, it ends up wit graphical characters instead of the word 'Active' or 'Obsolete'. What I see when I dump the array is this:

[RUMMY] => �����

I have tried doing string conversions and utf8_encode and nothing seems to display the actual value.

Any ideas on what I am doing wrong here?

Thanks!

aaron-s-hawley
Posts: 46
Joined: Thu Mar 11, 2010 4:43 pm
Location: Colchester, VT
Contact:

Re: SQL CASE function returns odd dada

Post by aaron-s-hawley » Tue Mar 30, 2010 9:00 pm

Quick thought: What if you put a CAST expression around your CASE expression? It's probably not necessary for DB2/SQL generally, but perhaps it needs to be to make its way to PHP in good standing.

scottgcampbell
Posts: 187
Joined: Wed Apr 22, 2009 2:29 pm
Location: Edmonton, AB, Canada

Re: SQL CASE function returns odd dada

Post by scottgcampbell » Wed Mar 31, 2010 1:44 pm


Post Reply