Forum Discussion

ashutosh01's avatar
ashutosh01
Contributor
9 months ago
Solved

I am putting query in double quotes but it is giving syntax error

Here if i put normal select query in double quotes it works fine, but if I put like this then it don't 

ADOCommand.CommandText= "

DO $$
DECLARE
record_count INTEGER;
BEGIN
LOOP
-- Perform your query here and store the record count in a variable
SELECT COUNT(*) INTO record_count FROM assaabloy_core_command_queue_message where
dsr_housekeeping = 'true' OR dsr_housekeeping = 'false';

-- Check if the record count is zero
IF record_count = 0 THEN
EXIT; -- Exit the loop if the condition is met
END IF;

-- Perform any actions you need to do while the condition is not met
-- ...

-- Optional: Add a delay between iterations to avoid excessive resource usage
PERFORM pg_sleep(1); -- Sleep for 1 second before the next iteration
END LOOP;
END $$;";

 

query is in postgresql

error showing is syntax but i can't figure out what that is

  • Template literals are literals delimited with backtick (`) characters

    var html = `
      <div>
        <span>Some HTML here</span>
      </div>
    `;