-1

We have to support same application for different databases. So I used same queries of postgres and got error response - DatabaseError: java.sql.SQLException: 'decode' is not a recognized built-in function name.

I am trying to find the Equivalent of Decode function of Postgres in MySQL and Oracle. Postgres Decode - https://www.educba.com/postgresql-decode/

decode('7B22', 'hex')

I found decode function but that is different not which I am looking for. So, any help will be appreciated.

Thanks

Mahesh Chand
  • 3,158
  • 19
  • 37
  • 1
    Sql is not a database, it is a programming language standard. – Shadow Aug 09 '23 at 09:36
  • Please describe what your current function does and in what database. Then add your target databases (SQL seems to be T-SQL according to the error message) – astentx Aug 09 '23 at 09:49
  • @Shadow I meant to say "MySql". – Mahesh Chand Aug 09 '23 at 10:03
  • @astentx U[pdated in question. Hope, it will help. – Mahesh Chand Aug 09 '23 at 10:04
  • There's no direct equivalent for [this function](https://www.postgresql.org/docs/current/functions-binarystring.html) in Oracle, you have to create your own wrapper and call appropriate function by using `CASE` statement: https://stackoverflow.com/q/18701984/2778710, https://stackoverflow.com/q/3804279/2778710. The same is for MySQL: https://stackoverflow.com/q/358500/2778710, https://stackoverflow.com/q/8339138/2778710. But note that converted string should have some character set information added. Otherwise you'll obtain broken text – astentx Aug 09 '23 at 11:17

0 Answers0