Comparing char case strings in Progress DB

I am writing about this because I found it to be suprisingly challanging. For the time being until I can come up with a better was to do this I am using the following method:


SELECT foo.mach_id
FROM OPENQUERY
(
    MYPROGRESSDATABASE
    ,
    '
    SELECT my_table."mach-id" AS mach_id
    FROM PUB.my_table
    WITH (NOLOCK)
    '
) AS foo
WHERE cast(foo.mach_id as varbinary(120)) != cast(UPPER(foo.mach_id) as varbinary(120));
            

the following example will filter and only give tuples that contain lowercase characters