Hi
In below colde i am gettimg error - Contains predicates on expression IFNULL
select * from "Result"
where "InvType" = 13
and not contains("GSTN", '%NOTAPPLICABLE%')
Thanks
Hi
In below colde i am gettimg error - Contains predicates on expression IFNULL
select * from "Result"
where "InvType" = 13
and not contains("GSTN", '%NOTAPPLICABLE%')
Thanks
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question.
Daniel WrightPosted Feb 21, 2025, 6:42 AM
It seems the error in your SQL query is due to the incorrect usage of the "contains" function. The "contains" function is typically used in databases like Oracle, but in your case, it appears to be causing a problem due to the presence of the IFNULL expression in the query. The IFNULL function is generally used to handle NULL values and provide an alternative value if a column contains NULL.
To resolve the error and achieve the desired result, you can adjust your query as follows:
In this modified query:
- We replaced the "contains" function with the standard SQL syntax using "NOT LIKE" to check if the "GSTN" column does not contain '%NOTAPPLICABLE%'.
- This adjustment should help you avoid the error related to the "contains" function and filter the results based on your criteria.
Feel free to test this modified query in your database environment, and let me know if you encounter any further issues or if you need additional assistance.
Jayraj ChhayaPosted Feb 21, 2025, 6:58 AM
Hi @Ramco Ramco,
The error you are experiencing is likely due to the incorrect usage of the
CONTAINSfunction in conjunction with theIFNULLexpression. In SQL, theCONTAINSfunction is typically used for full-text search and may not support wildcard patterns like '%NOTAPPLICABLE%' directly. Instead, you can use theNOT LIKEoperator for pattern matching.