I'm running this code in an Amazon Redshift query:
case when offer.disbursement_required = 'true' and (json_extract_array_element_text(offer.disbursement_requirements, 2, true) :: numeric <> offer.amount or (cast(json_extract_array_element_text(offer.disbursement_requirements, 2, true) :: numeric) is null or offer.amount is null)
and not ((cast(json_extract_array_element_text(offer.disbursement_requirements, 2, true)) :: numeric) is null and offer.amount is null) then 1
This is returning:
[Code: 500310, SQL State: 0A000] Amazon Invalid operation: cannot cast type cstring to numeric;
and I'm not sure why.
Any help would be appreciated!! :)