Executing PostgreSQL script lazarus / 16-Databases ---------------------------------------------------------------------- SymbolicFrank · 2023-06-14 11:44 I'm trying to run a script like this: Code: SQL  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i DO$do$BEGIN   IF EXISTS (SELECT FROM orders) THEN      DELETE FROM orders;   ELSE      INSERT INTO orders VALUES (1,2,3);   END IF;END$do$ It doesn't matter if I try to execute this with a TSQLQuery or TSQLScript, I always get this error: Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Primary Error: unterminated dollar-quoted string at or near "$do$ In pgAdmin it works as expected. ---------------------------------------------------------------------- gsa · 2023-06-14 12:48 Quote from: SymbolicFrank on June 14, 2023, 01:44:14 pm It doesn't matter if I try to execute this with a TSQLQuery or TSQLScript, I always get this error: Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Primary Error: unterminated dollar-quoted string at or near "$do$ In pgAdmin it works as expected. Using TSQLScript you should set the folowing properties:       UseDollarString := True;       DollarStrings.Add('$$');  Gerd ---------------------------------------------------------------------- SymbolicFrank · 2023-06-14 13:26 Ah, thanks. I had replaced the "$do$" with a single quote and doubled up all the other ones, but that makes a mess of it. ---------------------------------------------------------------------- gucao · 2023-06-15 01:57 uses tsqlquery is ok. test with lazarus 2.2.0.