/*
    vplesnlia: split input string in words
*/


DECLARE
    TYPE v_arr IS
        VARRAY(100) OF VARCHAR2(60);
    var          v_arr;
    return_value VARCHAR2(60);
BEGIN
    var := v_arr();
    FOR c1 IN (
        SELECT
            regexp_substr(
                '&&1', '[^ ]+', 1, level
            ) AS string_parts
        FROM
            dual
        CONNECT BY
            regexp_substr(
                '&&1', '[^ ]+', 1, level
            ) IS NOT NULL
    ) LOOP
        var.extend;
        var(var.last) := c1.string_parts;
    END LOOP;

    FOR i IN var.first..var.last LOOP
        return_value := var(i);
        dbms_output.put_line(return_value);
    END LOOP;

END;
