Perché chiedere di nuovo il nome di Tom dopo averlo già salutato?
A parte gli scherzi... sì. Puoi applicare la solita operazione di suddivisione delle stringhe su una stringa delimitata da CHR(10) — il carattere di a capo in Oracle — e poi usare le funzioni CAST e COLLECT per trasformarla in un array. Qui ho usato la collection integrata di Oracle sys.OdciVarchar2List. Nel tuo blocco PL/SQL, puoi fare il BULK COLLECT in qualsiasi tipo di collection adatto che contenga elementi stringa.
WITH t (s) AS ( SELECT 'Hello Tom Where are you What''s your name' FROM DUAL ) SELECT CAST ( COLLECT ( REGEXP_SUBSTR(s, '[^' || CHR(10)|| ']+', 1, LEVEL) ) AS sys.OdciVarchar2List ) as collection FROM t CONNECT BY LEVEL <= REGEXP_COUNT(s, '[^' || CHR(10)|| ']+')| COLLECTION | |------------------------------------------| | Hello Tom,Where are you,What's your name |