this is my exam
DO $$DECLARE
oldName varchar :='old';
newName varchar := 'new';
BEGIN
....
END$$;
If I run this script get this:
ERROR: syntax error at or near "DO" LINE 1: DO $$ DECLARE ^
What I did wrong?
this is my exam
DO $$DECLARE
oldName varchar :='old';
newName varchar := 'new';
BEGIN
....
END$$;
If I run this script get this:
ERROR: syntax error at or near "DO" LINE 1: DO $$ DECLARE ^
What I did wrong?
I'd say you are using PostgreSQL 8.4 or older, which does not support DO
blocks. You will need to either upgrade, or use CREATE OR REPLACE FUNCTION
to create a PL/PgSQL function, then SELECT function_name()
to call it.
Always specify your PostgreSQL version in questions.