I'm try to convert my Oracle function which contains SUBSTR() to PostgreSQL. Is there an equivalent function in PSQL? Thanks.
I manage to find a Oracle Instr() conversion to PostgreSQL.
I'm try to convert my Oracle function which contains SUBSTR() to PostgreSQL. Is there an equivalent function in PSQL? Thanks.
I manage to find a Oracle Instr() conversion to PostgreSQL.
You can use a code from Postgres documentation mentioned by michel-sim. Other possibility is Orafce extension - https://github.com/orafce/orafce or http://postgres.cz/wiki/Oracle_functionality_%28en%29 that is available for RedHat or Debian as binary package too.
Install.orafunc - ..install Orafce functions in the database, either run the orafce.sql script using the pgAdmin SQL tool..I tried running the orafce--3.0.sql, it give me error ERROR: could not access file "MODULE_PATHNAME": No such file or directory. What do you mean by module path?CREATE EXTENSION orafce. Here's my linkThere's substring, but you'd have to modify the invocations -- instead of substr(x, i, j) you need substring(x from i to j)
substr you're used to ... but it's better to use orafce as Pavel suggested.