[SalesForce] Error: Compile Error: Invalid bind expression type of String for column of type Decimal at line 395 column 176

Error: Compile Error: Invalid bind expression type of String for
column of type Decimal at line 395 column 176

How do I understand which field exactly to check?
Here Baseline_Volume__c field is defined as Number in object.

public static Map<string, decimal> getRecruitmentDriverTaleoBaseline(string month,string year,string ref){


    decimal recruitmentVolume = 0.0;              
    Set<String> countryList = DriverCountry__c.getAll().keySet();    
    Map<string,decimal> driverVolumeMap = new Map<string, decimal>();       

    Map<string,string> countryNameMap = returncountryNameMap();
line 395 ---> for(AdjustmentObj__c adj : [Select Id, Reference_Number__c, Country__c, Baseline_Volume__c, Month__c, Year__c from AdjustmentObj__c where Month__c =: month and Year__c =: year and Reference_Number__c =: ref]){
    driverVolumeMap.put(adj.Month__c+SINGLE_DASH+adj.Country__c,adj.Baseline_Volume__c);
    }
    // LOOPING THROUGH THE LIST OF COUNTRIES TO INSERT THE WHOLE LIST IF ANY OF THOSE MISSED OUT IN THE DATA 
    for(String country : countryList){        
        if(!driverVolumeMap.containsKey(month+SINGLE_DASH+country) && ref != NUMBER_THIRTEEN && country != null){
            driverVolumeMap.put(month+SINGLE_DASH+country,0.0);
        }
    }
    return driverVolumeMap; 
}

The bold line is line 395.

Best Answer

The clause in your SOQL

where Month__c =: month and Year__c =: year and Reference_Number__c =: ref

and the error message

Invalid bind expression type of String for column of type Decimal at line 395 column 176

is most likely, as @Himanshu said that Reference_Number__c is a field of type Number but local variable ref is of type String. Change to:

where Month__c =: month and Year__c =: year and Reference_Number__c =: Decimal.valueOf(ref)