0

I have an 18 character Salesforce ID:

XXXXJ00000326hjQAA

When it's used in an SOQL query:

Id recordId = Id.valueOf('XXXXJ00000326hjQAA');
List<Opportunity> records = [SELECT ID FROM Opportunity WHERE ID = :recordId];
System.debug(records.size());

It returns 1 record.

But when the 18 character Salesforce ID is all upper case:

XXXXJ00000326HJQAA

It returns 0 records.

I thought 18 character Salesforce ID's were case-insensitive.

Why is it not returning a record?