Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can use the <a href="http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions026.htm" rel="nofollow"><code>chr</code> function</a> to replace a character with it's numeric equivalent.</p> <pre><code>SYS_CONNECT_BY_PATH(column name, chr(33)) </code></pre> <p>Or to use a line feed, which should also be fine:</p> <pre><code>SYS_CONNECT_BY_PATH(column name, chr(13)) </code></pre> <p>It's not strictly ASCII as it depends on your character set, but it will probably work for you. You can see the numeric values using the reverse <a href="http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions013.htm" rel="nofollow"><code>ascii</code> function</a>, which also isn't really quite ASCII, but again close enough especially if you're always using the same character set. So <code>ascii('!')</code> would give you <code>33</code>.</p> <hr> <p>As you've discovered, giving anything except a fixed string literal gives:</p> <blockquote> <pre><code>SQL Error: ORA-30003: illegal parameter in SYS_CONNECT_BY_PATH function 30003. 00000 - "illegal parameter in SYS_CONNECT_BY_PATH function" *Cause: *Action: use a non-empty constant string as the second argument, then retry the operation. </code></pre> </blockquote> <p>This is why I usually test things before posting, but this seemed so simple... You can get around that with <code>replace</code>:</p> <pre><code>REPLACE(SYS_CONNECT_BY_PATH(column name, '/'), '/', chr(33)) </code></pre> <p>Borrowing an <a href="http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions183.htm" rel="nofollow">example from the manual</a>:</p> <pre><code>SELECT LPAD(' ', 2*level-1) ||replace(SYS_CONNECT_BY_PATH(last_name, '/'),'/',chr(33)) "Path" FROM employees START WITH last_name = 'Kochhar' CONNECT BY PRIOR employee_id = manager_id; Path -------------------------------------------------- !Kochhar !Kochhar!Greenberg !Kochhar!Greenberg!Faviet !Kochhar!Greenberg!Chen !Kochhar!Greenberg!Sciarra !Kochhar!Greenberg!Urman !Kochhar!Greenberg!Popp !Kochhar!Whalen !Kochhar!Mavris !Kochhar!Baer !Kochhar!Higgins !Kochhar!Higgins!Gietz </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload