SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
Code snippets bug while using $$

 
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant View previous topic
View next topic
Code snippets bug while using $$
Author Message
michalk



Joined: 29 Aug 2014
Posts: 142

Post Code snippets bug while using $$ Reply with quote
Hello
I tried to define snippet for DO LANGUAGE construct as follows:

Code:
DO LANGUAGE $$
DECLARE

BEGIN
    |
END $$;


With following syntax SA fails with error:
Code:

Code 7, State 42601,    ERROR: syntax error at or near "|"; Error while executing the query
Executing user-defined query in line 1 ... Failed


If I remove pipe character, then get error:

Code:
Code 7, State 42601,    ERROR: syntax error at or near "END"; Error while executing the query
Executing user-defined query in line 1 ... Failed


After removing double-dollars, it works as expected.

PS. Tested in SQL Editor
Thu Nov 05, 2015 6:15 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 6508

Post Reply with quote
$$..$$ is a special macro in that SQL Assistant uses in code snippets for executing custom SQL queries during macro execution. The results of the queries is dynamically expanded and inserted into the snippet code. So that is not a bug, it's a feature. Please see the documentation for more details.

If you need literal $ symbols in the code, you need to escape them, in your case you would use $^$^. There is an example in the documentation, see "Escaping $ Symbols in Snippet Codes"
Sat Nov 07, 2015 1:55 am View user's profile Send private message
michalk



Joined: 29 Aug 2014
Posts: 142

Post Reply with quote
Works like a charm. Thank you.
Tue Nov 10, 2015 8:51 am View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.