In MySQL the below query is executing properly.
SELECT * FROM <Table-name> WHERE (Table.ID LIKE '1%')
But when I try to execute the above query in Postgres, I get the following exception
"org.postgresql.util.PSQLException: ERROR: operator does not exist: integer ~~ unknown Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts".
If I convert the same query
SELECT *
FROM <Table-name>
WHERE CAST(Table.ID as TEXT) LIKE '1%'
This gets executed directly in Postgres DB. But I need some query which implicitly type cast in DB, which allows me to execute the MySQL query without any exception. Because I remember there is a way for integer to boolean implicit type cast.
Thanks in advance.
{ }
) on the editor toolbar to nicely format and syntax highlight it!LIKE
does not make sense. If those aren't "real" numbers than store them in avarchar
column.