Toad World® Forums

Code Templates - Corruption of Concatenations

If I have a code template with a concatenation || in it, one of the pipe characters gets removed, which makes the syntax incorrect. The help says if it looks for a single pipe, it’ll place the caret there, but a concatenation isn’t a single pipe. The code should check that it isn’t a double pipe. I could triple pipe in the code, but it seems a silly workaround and makes the code non transportable (as it has a syntax error).

Test example. I have a template for a standard recursive subquery refactoring called RSF in my code templates as below… Notice the bold concat.

with treewalk(ID, PARENT_ID, NAME, PATH, LVL) as (
select ID, PARENT_ID, NAME, cast(NAME as varchar2(4000)), 1 – Anchor
where PARENT_ID is null
union all
select a.ID, a.PARENT_ID, a.NAME, t.NAME || ‘’ || a.NAME, t.LVL + 1
from treewalk t
join T_CUSTOMER a on a.PARENT_ID = t.ID
search breadth first by NAME set node_order /* or depth first */
select *
from treewalk

It gets replaced with…


select a.ID, a.PARENT_ID, a.NAME, t.NAME | ‘’ || a.NAME, t.LVL + 1


making a syntax error.

Pipe character in code templates is used to set the caret placement after insertion. This is as-designed. If you wish to retain the pipe character then check the “Advanced” checkbox for the template.

Advanced code templates support the following macros… and . Use those to set caret placement, insert clipboard contents, or add a timestamp. The macro supports setting the datetime format when followed by colon. Example… timestamp:mm/dd/yyyy