I have a problem to convert a script from Oracle to Postgres:
WITH q AS (
SELECT 'ABCDE' str
FROM dual)
SELECT 'TEST' AS WL_ID
,substr(str, LEVEL, 1) AS SUPPLY_MODE_ID
FROM q connect BY LEVEL < length(q.str) + 1;
I tried this in Postgres:
WITH RECURSIVE t(n)
AS (SELECT 'TEST', substring('ABCDE', 1, 1)
UNION ALL
SELECT 'TEST', substring('ABCDE', n+1,1)
FROM t
where n<length('ABCDE')
)
SELECT * FROM t
I have the error :
ERROR: operator does not exist: text + integer
I don't know how to return exactly the same result as in Oracle.