Можете да използвате функция за конвейер:
CREATE or replace TYPE test_type AS TABLE OF varchar2(40)
CREATE or replace FUNCTION test_func (d VARCHAR2)
RETURN test_type
PIPELINED
IS
BEGIN
FOR C1 IN ( SELECT REGEXP_SUBSTR (d, '[^,]+', 1, LEVEL) x
FROM DUAL
CONNECT BY REGEXP_SUBSTR (d, '[^,]+', 1, LEVEL) IS NOT NULL)
LOOP
PIPE ROW (c1.x);
END LOOP;
END;
/
WITH test
AS ( your_query_here )
SELECT x.id2, x.mydate, y.*
FROM test x, TABLE (test_func (x.d)) y
Използвам тук mydate вместо date (запазена дума) и d вместо data. Пример:
WITH test
AS (SELECT 2 AS id2, SYSDATE AS mydate, '1.0,1.1,1.2,11,1.4,1.5,2.6,2.7,2.8,2.9,44,55' AS d FROM DUAL
UNION ALL
SELECT 3 AS id2, SYSDATE + 1 AS mydate, '19.5,19.9,11.5,11.1,21.2,33,1.4,1.5,2.6,2.7,2.8,2.9' AS d
FROM DUAL
UNION ALL
SELECT 4 AS id2, SYSDATE + 1 AS mydate, '9.5,9.9,1.5,1.1,1.2,66,1.4,1.5,2.6,2.7,2.8,2.9' AS d
FROM DUAL)
SELECT x.id2, x.mydate, y.*
FROM test x, TABLE (test_func (x.d)) y
Някои връзки:
Как да разделя низ, разделен със запетая, и да премине към клауза IN на оператор select
Използване на конвейерни и паралелни таблични функции